Commit 1668795c authored by Riri Novita's avatar Riri Novita

ropl

parent 3e88701f
...@@ -256,6 +256,11 @@ const create = (type = "") => { ...@@ -256,6 +256,11 @@ const create = (type = "") => {
const getRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/get_report_hierarki', body) const getRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/get_report_hierarki', body)
const getRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/get_report_hierarki', body) const getRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/get_report_hierarki', body)
const createRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/store_ro_tax_planning', body) const createRollingOutlookTP = (body) => api.post('transaction/rolling_outlook/tax_planning/store_ro_tax_planning', body)
const getRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_operating_indicator_id', body)
const getHierarkiRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_report_hierarki', body)
const createRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/create_monthly_report', body)
const getLastestUpdateROOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_latest_update', body)
//REPORT NEW //REPORT NEW
...@@ -728,7 +733,12 @@ const create = (type = "") => { ...@@ -728,7 +733,12 @@ const create = (type = "") => {
getRollingOutlookRevision, getRollingOutlookRevision,
getRollingOutlookIsApprover, getRollingOutlookIsApprover,
checkImportRollingOutlookBS, checkImportRollingOutlookBS,
importRollingOutlookBS importRollingOutlookBS,
getRollingOI,
getHierarkiRollingOI,
createRollingOI,
getLastestUpdateROOI
} }
} }
......
...@@ -80,7 +80,7 @@ export default class OperatingIndicator extends Component { ...@@ -80,7 +80,7 @@ export default class OperatingIndicator extends Component {
} }
getLastPeriod() { getLastPeriod() {
api.create().getLastPeriodOI(this.state.company.company_id).then(response => { api.create().getLastPeriodOI(this.state.company.company_id).then(response => {
// console.log(response); // console.log(response);
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => { this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
...@@ -190,7 +190,7 @@ export default class OperatingIndicator extends Component { ...@@ -190,7 +190,7 @@ export default class OperatingIndicator extends Component {
}) })
if (arrayBaru.length > 0) { if (arrayBaru.length > 0) {
arrayBaru = arrayBaru.sort((a,b) => a.company_name.localeCompare(b.company_name)) arrayBaru = arrayBaru.sort((a, b) => a.company_name.localeCompare(b.company_name))
} }
let defaultProps = { let defaultProps = {
...@@ -315,22 +315,22 @@ export default class OperatingIndicator extends Component { ...@@ -315,22 +315,22 @@ export default class OperatingIndicator extends Component {
visibleDetailOpt: true, visibleDetailOpt: true,
visibleDetailMonthly: false, visibleDetailMonthly: false,
visibleDetailRolling: false visibleDetailRolling: false
}) })
} else if (String(item[1]).toLocaleLowerCase().includes("monthly report")) { } else if (String(item[1]).toLocaleLowerCase().includes("monthly report")) {
console.log(item); console.log(item);
let month = String(item[1]).toLocaleLowerCase().includes('jan') ? 1 : let month = String(item[1]).toLocaleLowerCase().includes('jan') ? 1 :
String(item[1]).toLocaleLowerCase().includes('feb') ? 2 : String(item[1]).toLocaleLowerCase().includes('feb') ? 2 :
String(item[1]).toLocaleLowerCase().includes('mar') ? 3 : String(item[1]).toLocaleLowerCase().includes('mar') ? 3 :
String(item[1]).toLocaleLowerCase().includes('apr') ? 4 : String(item[1]).toLocaleLowerCase().includes('apr') ? 4 :
String(item[1]).toLocaleLowerCase().includes('may') ? 5 : String(item[1]).toLocaleLowerCase().includes('may') ? 5 :
String(item[1]).toLocaleLowerCase().includes('jun') ? 6 : String(item[1]).toLocaleLowerCase().includes('jun') ? 6 :
String(item[1]).toLocaleLowerCase().includes('jul') ? 7 : String(item[1]).toLocaleLowerCase().includes('jul') ? 7 :
String(item[1]).toLocaleLowerCase().includes('aug') ? 8 : String(item[1]).toLocaleLowerCase().includes('aug') ? 8 :
String(item[1]).toLocaleLowerCase().includes('sep') ? 9 : String(item[1]).toLocaleLowerCase().includes('sep') ? 9 :
String(item[1]).toLocaleLowerCase().includes('oct') ? 10 : String(item[1]).toLocaleLowerCase().includes('oct') ? 10 :
String(item[1]).toLocaleLowerCase().includes('nov') ? 11 : String(item[1]).toLocaleLowerCase().includes('nov') ? 11 :
String(item[1]).toLocaleLowerCase().includes('dec') ? 12 : null String(item[1]).toLocaleLowerCase().includes('dec') ? 12 : null
this.setState({ this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(), statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company }, dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
...@@ -339,18 +339,22 @@ export default class OperatingIndicator extends Component { ...@@ -339,18 +339,22 @@ export default class OperatingIndicator extends Component {
visibleDetailMonthly: true, visibleDetailMonthly: true,
visibleDetailRolling: false, visibleDetailRolling: false,
months: month months: month
}) })
} else if (String(item[1]).toLocaleLowerCase().includes("rolling outlook")) { } else if (String(item[1]).toLocaleLowerCase().includes("rolling outlook")) {
let quarter =String(item[1]).toLocaleLowerCase().includes('q1') ? "q1" :
String(item[1]).toLocaleLowerCase().includes('q2') ? "q2" :
String(item[1]).toLocaleLowerCase().includes('q3') ? "q3" : null
this.setState({ this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(), statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company }, dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
visibleOperatingIndicator: false, visibleOperatingIndicator: false,
visibleDetailOpt: false, visibleDetailOpt: false,
visibleDetailMonthly: false, visibleDetailMonthly: false,
visibleDetailRolling: true visibleDetailRolling: true,
quartal: quarter
}) })
} else { } else {
this.setState({ this.setState({
...@@ -360,7 +364,7 @@ export default class OperatingIndicator extends Component { ...@@ -360,7 +364,7 @@ export default class OperatingIndicator extends Component {
visibleDetailOpt: false, visibleDetailOpt: false,
visibleDetailMonthly: false, visibleDetailMonthly: false,
visibleDetailRolling: true visibleDetailRolling: true
}) })
} }
...@@ -421,7 +425,7 @@ export default class OperatingIndicator extends Component { ...@@ -421,7 +425,7 @@ export default class OperatingIndicator extends Component {
} }
saveRollingOI(payload) { saveRollingOI(payload) {
api.create().createMonthlyReportOI(payload).then((response) => { api.create().createRollingOI(payload).then((response) => {
console.log(response); console.log(response);
this.getReport() this.getReport()
this.getOperatingID() this.getOperatingID()
...@@ -504,10 +508,10 @@ export default class OperatingIndicator extends Component { ...@@ -504,10 +508,10 @@ export default class OperatingIndicator extends Component {
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
tableMeta.rowData[4] ? // tableMeta.rowData[4] ?
this.clickDetail(tableMeta.rowData, tableMeta.rowData[1], tableMeta.rowData[3], tableMeta.rowData[2]) 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> <Typography style={{ color: tableMeta.rowData[4] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
...@@ -640,7 +644,7 @@ export default class OperatingIndicator extends Component { ...@@ -640,7 +644,7 @@ export default class OperatingIndicator extends Component {
})} })}
getReport={() => this.getOperatingID()} getReport={() => this.getOperatingID()}
saveOperatingInd={this.saveOperatingInd.bind(this)} saveOperatingInd={this.saveOperatingInd.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit} isSubmit={this.state.statusDetail == 'closed' ? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }} permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/> />
} }
...@@ -658,7 +662,7 @@ export default class OperatingIndicator extends Component { ...@@ -658,7 +662,7 @@ export default class OperatingIndicator extends Component {
})} })}
getReport={() => this.getOperatingID()} getReport={() => this.getOperatingID()}
saveMonthlyOI={this.saveMonthlyOI.bind(this)} saveMonthlyOI={this.saveMonthlyOI.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit} isSubmit={this.state.statusDetail == 'closed' ? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }} permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/> />
} }
...@@ -669,7 +673,7 @@ export default class OperatingIndicator extends Component { ...@@ -669,7 +673,7 @@ export default class OperatingIndicator extends Component {
data={this.state.dataDetail} data={this.state.dataDetail}
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
months={this.state.months} quartal={this.state.quartal}
company={this.state.company} company={this.state.company}
onClickClose={() => this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true }, () => { onClickClose={() => this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID() this.getOperatingID()
...@@ -677,7 +681,7 @@ export default class OperatingIndicator extends Component { ...@@ -677,7 +681,7 @@ export default class OperatingIndicator extends Component {
})} })}
getReport={() => this.getOperatingID()} getReport={() => this.getOperatingID()}
saveRollingOI={this.saveRollingOI.bind(this)} saveRollingOI={this.saveRollingOI.bind(this)}
isSubmit={this.state.statusDetail == 'closed'? false : this.state.isSubmit} isSubmit={this.state.statusDetail == 'closed' ? false : this.state.isSubmit}
permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }} permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/> />
} }
......
...@@ -11,6 +11,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -11,6 +11,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import Constant from '../../library/Constant';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -41,64 +42,117 @@ export default class OperatingIndicatorRO extends Component { ...@@ -41,64 +42,117 @@ export default class OperatingIndicatorRO extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
dataTable: [ dataTable: [],
// ["TOTAL ASSETS", "11,247,249", "10,702,196"], loading: true,
// ["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"],
// ["Cash & Cash Equivalent", "1,464,571", "729,743"],
// ["Cash & Bank Balance", "938,707", "265,584"],
// ["Time & Call Deposit", "525,864", "464,159"],
// ["BI Deposit", "", ""],
// ["Marketable Securities", "150,250", "154,500"],
// ["Notes Receivable", "", ""],
// ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"],
],
visibleOI: true, visibleOI: true,
updateBy: '-',
notesUpdate: '-',
disabledSave: true, disabledSave: true,
editable: true, editable: true,
emptyData: false, emptyData: false,
templateNull: true templateNull: true,
judulColumn: null,
saveDraft: true,
viewOnly: true,
get_for: 'view'
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() {
// this.getDataDetail()
this.getDataDetail()
this.getLatestUpdate()
this.handleViewOnly()
// // console.log(this.props);
}
handleViewOnly() {
let checkCreate = this.props.permission.create
let checkEdit = this.props.permission.edit
this.setState({ viewOnly: checkCreate && checkEdit })
}
handleGetFor(type) {
this.setState({ get_for: type }, () => {
// this.getLatestUpdate()
this.getOperatingIDRolling()
})
}
getOperatingIDRolling() {
// console.log(this.props.data.operatingIndID);
let payload = {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"quartal": this.props.quartal
}
console.log(payload);
api.create().getRollingOI(payload).then(response => {
console.log(response);
if (response) {
if (response.data.data) {
this.setState({ operatingIndIDRolling: response.data.data.operating_indicator_id }, () => {
this.getDataDetail()
this.getLatestUpdate()
})
} else {
this.setState({ operatingIndIDRolling: null }, () => {
this.getDataDetail()
this.getLatestUpdate()
})
}
}
})
}
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDRolling,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
"quartal": this.props.quartal
} }
api.create().getLastestUpdateOI(payload).then(response => { // console.log(payload);
// // console.log(response.data) api.create().getLastestUpdateROOI(payload).then(response => {
// console.log(response.data)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notesUpdate: response.data.data.notes_update === null ? '-' : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
}) })
} }
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
}) })
} }
componentDidMount() {
// this.getItemHierarki()
this.getDataDetail()
this.getLatestUpdate()
// // console.log(this.props);
}
getDataDetail() { getDataDetail() {
this.setState({ loading: true }) this.setState({ loading: true })
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDRolling,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode "periode": this.props.data.periode,
"quartal": this.props.quartal,
"get_for": "view"
} }
console.log(payload) console.log(payload)
api.create().getOperatingIndDetail(payload).then(response => { api.create().getHierarkiRollingOI(payload).then(response => {
console.log(response) console.log(response)
let dataTable = [] let dataTable = []
let res = response.data.data let res = response.data.data
...@@ -114,20 +168,19 @@ export default class OperatingIndicatorRO extends Component { ...@@ -114,20 +168,19 @@ export default class OperatingIndicatorRO extends Component {
item.level, item.level,
item.description, item.description,
item.uom, item.uom,
item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1), item.rolling_outlook.january == "" ? item.rolling_outlook.january : String(item.rolling_outlook.january).indexOf(".") == -1 ? Number(item.rolling_outlook.january) : Number(item.rolling_outlook.january).toFixed(1),
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1), item.rolling_outlook.february == "" ? item.rolling_outlook.february : String(item.rolling_outlook.february).indexOf(".") == -1 ? Number(item.rolling_outlook.february) : Number(item.rolling_outlook.february).toFixed(1),
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1), item.rolling_outlook.march == "" ? item.rolling_outlook.march : String(item.rolling_outlook.march).indexOf(".") == -1 ? Number(item.rolling_outlook.march) : Number(item.rolling_outlook.march).toFixed(1),
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1), item.rolling_outlook.april == "" ? item.rolling_outlook.april : String(item.rolling_outlook.april).indexOf(".") == -1 ? Number(item.rolling_outlook.april) : Number(item.rolling_outlook.april).toFixed(1),
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1), item.rolling_outlook.may == "" ? item.rolling_outlook.may : String(item.rolling_outlook.may).indexOf(".") == -1 ? Number(item.rolling_outlook.may) : Number(item.rolling_outlook.may).toFixed(1),
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1), item.rolling_outlook.june == "" ? item.rolling_outlook.june : String(item.rolling_outlook.june).indexOf(".") == -1 ? Number(item.rolling_outlook.june) : Number(item.rolling_outlook.june).toFixed(1),
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1), item.rolling_outlook.july == "" ? item.rolling_outlook.july : String(item.rolling_outlook.july).indexOf(".") == -1 ? Number(item.rolling_outlook.july) : Number(item.rolling_outlook.july).toFixed(1),
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1), item.rolling_outlook.august == "" ? item.rolling_outlook.august : String(item.rolling_outlook.august).indexOf(".") == -1 ? Number(item.rolling_outlook.august) : Number(item.rolling_outlook.august).toFixed(1),
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1), item.rolling_outlook.september == "" ? item.rolling_outlook.september : String(item.rolling_outlook.september).indexOf(".") == -1 ? Number(item.rolling_outlook.september) : Number(item.rolling_outlook.september).toFixed(1),
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1), item.rolling_outlook.october == "" ? item.rolling_outlook.october : String(item.rolling_outlook.october).indexOf(".") == -1 ? Number(item.rolling_outlook.october) : Number(item.rolling_outlook.october).toFixed(1),
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1), item.rolling_outlook.november == "" ? item.rolling_outlook.november : String(item.rolling_outlook.november).indexOf(".") == -1 ? Number(item.rolling_outlook.november) : Number(item.rolling_outlook.november).toFixed(1),
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1), item.rolling_outlook.december == "" ? item.rolling_outlook.december : String(item.rolling_outlook.december).indexOf(".") == -1 ? Number(item.rolling_outlook.december) : Number(item.rolling_outlook.december).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1), item.rolling_outlook.total_current_year == "" ? item.rolling_outlook.total_current_year : String(item.rolling_outlook.total_current_year).indexOf(".") == -1 ? Number(item.rolling_outlook.total_current_year) : Number(item.rolling_outlook.total_current_year).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order item.order
]) ])
} }
...@@ -148,20 +201,19 @@ export default class OperatingIndicatorRO extends Component { ...@@ -148,20 +201,19 @@ export default class OperatingIndicatorRO extends Component {
item.level, item.level,
item.description, item.description,
item.uom, item.uom,
item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1), item.rolling_outlook.january == "" ? item.rolling_outlook.january : String(item.rolling_outlook.january).indexOf(".") == -1 ? Number(item.rolling_outlook.january) : Number(item.rolling_outlook.january).toFixed(1),
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1), item.rolling_outlook.february == "" ? item.rolling_outlook.february : String(item.rolling_outlook.february).indexOf(".") == -1 ? Number(item.rolling_outlook.february) : Number(item.rolling_outlook.february).toFixed(1),
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1), item.rolling_outlook.march == "" ? item.rolling_outlook.march : String(item.rolling_outlook.march).indexOf(".") == -1 ? Number(item.rolling_outlook.march) : Number(item.rolling_outlook.march).toFixed(1),
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1), item.rolling_outlook.april == "" ? item.rolling_outlook.april : String(item.rolling_outlook.april).indexOf(".") == -1 ? Number(item.rolling_outlook.april) : Number(item.rolling_outlook.april).toFixed(1),
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1), item.rolling_outlook.may == "" ? item.rolling_outlook.may : String(item.rolling_outlook.may).indexOf(".") == -1 ? Number(item.rolling_outlook.may) : Number(item.rolling_outlook.may).toFixed(1),
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1), item.rolling_outlook.june == "" ? item.rolling_outlook.june : String(item.rolling_outlook.june).indexOf(".") == -1 ? Number(item.rolling_outlook.june) : Number(item.rolling_outlook.june).toFixed(1),
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1), item.rolling_outlook.july == "" ? item.rolling_outlook.july : String(item.rolling_outlook.july).indexOf(".") == -1 ? Number(item.rolling_outlook.july) : Number(item.rolling_outlook.july).toFixed(1),
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1), item.rolling_outlook.august == "" ? item.rolling_outlook.august : String(item.rolling_outlook.august).indexOf(".") == -1 ? Number(item.rolling_outlook.august) : Number(item.rolling_outlook.august).toFixed(1),
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1), item.rolling_outlook.september == "" ? item.rolling_outlook.september : String(item.rolling_outlook.september).indexOf(".") == -1 ? Number(item.rolling_outlook.september) : Number(item.rolling_outlook.september).toFixed(1),
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1), item.rolling_outlook.october == "" ? item.rolling_outlook.october : String(item.rolling_outlook.october).indexOf(".") == -1 ? Number(item.rolling_outlook.october) : Number(item.rolling_outlook.october).toFixed(1),
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1), item.rolling_outlook.november == "" ? item.rolling_outlook.november : String(item.rolling_outlook.november).indexOf(".") == -1 ? Number(item.rolling_outlook.november) : Number(item.rolling_outlook.november).toFixed(1),
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1), item.rolling_outlook.december == "" ? item.rolling_outlook.december : String(item.rolling_outlook.december).indexOf(".") == -1 ? Number(item.rolling_outlook.december) : Number(item.rolling_outlook.december).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1), item.rolling_outlook.total_current_year == "" ? item.rolling_outlook.total_current_year : String(item.rolling_outlook.total_current_year).indexOf(".") == -1 ? Number(item.rolling_outlook.total_current_year) : Number(item.rolling_outlook.total_current_year).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -172,7 +224,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -172,7 +224,7 @@ export default class OperatingIndicatorRO extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false }, () => { this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true }, () => {
if (this.state.dataTable.length == 0) { if (this.state.dataTable.length == 0) {
this.setState({ emptyData: true }) this.setState({ emptyData: true })
} }
...@@ -209,7 +261,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -209,7 +261,7 @@ export default class OperatingIndicatorRO extends Component {
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
"status": type, "status": type,
"master_budget": payloadMB "rolling_outlook": payloadMB
} }
console.log(payload); console.log(payload);
// // console.log('=========================') // // console.log('=========================')
...@@ -283,7 +335,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -283,7 +335,7 @@ export default class OperatingIndicatorRO extends Component {
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
) )
res = await res.blob() res = await res.blob()
// // console.log(res) // // console.log(res)
...@@ -301,7 +353,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -301,7 +353,7 @@ export default class OperatingIndicatorRO extends Component {
let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode] let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode]
// // console.log(bram) // // console.log(bram)
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
) )
res = await res.blob() res = await res.blob()
...@@ -356,7 +408,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -356,7 +408,7 @@ export default class OperatingIndicatorRO extends Component {
company_id: this.props.data.company.company_id, company_id: this.props.data.company.company_id,
periode: this.props.data.periode, periode: this.props.data.periode,
report_id: this.props.data.report_id, report_id: this.props.data.report_id,
master_budget: payload, rolling_outlook: payload,
status: 'submitted' status: 'submitted'
} }
console.log(body) console.log(body)
...@@ -405,7 +457,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -405,7 +457,7 @@ export default class OperatingIndicatorRO extends Component {
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, templateNull : total > 0 ? true : false }) this.setState({ dataTable, dataLoaded: true, loading: false, templateNull: total > 0 ? true : false })
} }
} }
}) })
...@@ -440,7 +492,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -440,7 +492,7 @@ export default class OperatingIndicatorRO extends Component {
periode: this.props.data.periode, periode: this.props.data.periode,
report_id: this.props.data.report_id, report_id: this.props.data.report_id,
status: type, status: type,
master_budget: data rolling_outlook: data
} }
// // console.log(data); // // console.log(data);
// // console.log(JSON.stringify(body)) // // console.log(JSON.stringify(body))
...@@ -527,11 +579,11 @@ export default class OperatingIndicatorRO extends Component { ...@@ -527,11 +579,11 @@ export default class OperatingIndicatorRO extends Component {
if (item == '-' || item == '+' || item == '/' || item == '*') { if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item opet = item
} else { } else {
arrayFormulaConvert.push(opet == ''? Number(item) : Number(String(opet + String(item)))) arrayFormulaConvert.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false tambahan = false
opet = "" opet = ""
} }
} else { } else {
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex] let valuezz = dataTable2[indexID][tableMeta.columnIndex]
// // // console.log(dataTable2[indexID]) // // // console.log(dataTable2[indexID])
...@@ -689,9 +741,27 @@ export default class OperatingIndicatorRO extends Component { ...@@ -689,9 +741,27 @@ export default class OperatingIndicatorRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === null || tableMeta.rowData[0] === 1 ?
null null
: :
this.state.get_for == 'view' ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
type="text"
placeholder=""
defaultValue={value}
// color={"#5198ea"}
value={value}
disabled={true}
// onBlur={(event) => {
// // // console.log(event.target.value)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
:
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
...@@ -730,9 +800,20 @@ export default class OperatingIndicatorRO extends Component { ...@@ -730,9 +800,20 @@ export default class OperatingIndicatorRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -819,6 +900,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -819,6 +900,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -904,6 +996,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -904,6 +996,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -989,6 +1092,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -989,6 +1092,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1074,6 +1188,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1074,6 +1188,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1159,6 +1284,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1159,6 +1284,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1244,6 +1380,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1244,6 +1380,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1329,6 +1476,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1329,6 +1476,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1414,6 +1572,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1414,6 +1572,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1499,6 +1668,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1499,6 +1668,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1584,6 +1764,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1584,6 +1764,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1669,6 +1860,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1669,6 +1860,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1754,6 +1956,17 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1754,6 +1956,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null null
: :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(value).toFixed(1)}
/>
:
tableMeta.rowData[0] == 2 ? tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1863,12 +2076,18 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1863,12 +2076,18 @@ export default class OperatingIndicatorRO extends Component {
{!this.state.emptyData && <div style={{ display: 'flex', justifyContent: 'space-between' }}> {!this.state.emptyData && <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}
{
this.props.quartal === "q1" ? ' Q1 ' :
this.props.quartal === "q2" ? ' Q2 ' :
this.props.quartal === "q3" ? ' Q3 ' : ''
}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{(this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Download Template'} data-for="template"> {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1882,7 +2101,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1882,7 +2101,7 @@ export default class OperatingIndicatorRO extends Component {
</button> </button>
</a>} </a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{(this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Upload'} data-for="upload"> {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1916,18 +2135,21 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1916,18 +2135,21 @@ export default class OperatingIndicatorRO extends Component {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}> {!this.state.loading &&
<MUIDataTable <MuiThemeProvider theme={getMuiTheme()}>
data={dataTable2} <MUIDataTable
columns={columns} data={dataTable2}
options={options} columns={columns}
/> options={options}
</MuiThemeProvider> />
</MuiThemeProvider>
}
</div> </div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notesUpdate}</Typography>
</div> </div>
<div className="grid grid-2x"> <div className="grid grid-2x">
<div className="col-1"> <div className="col-1" style={{ paddingLeft: 20 }}>
<button <button
className="button" className="button"
type="button" type="button"
...@@ -1947,63 +2169,88 @@ export default class OperatingIndicatorRO extends Component { ...@@ -1947,63 +2169,88 @@ export default class OperatingIndicatorRO extends Component {
</div> </div>
</button> </button>
</div> </div>
{!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}>
<button {this.state.get_for == 'view' && this.state.viewOnly &&
type="button" <button
onClick={() => type="button"
this.setState({ loading: true, editable: false }, () => { onClick={() => {
setTimeout(() => { this.setState({loading: true}, () => {
this.setState({ loading: false, buttonError: false }) this.handleGetFor('edit')
}, 100); })
}) }}
} style={{ marginRight: 21 }}
style={{ marginRight: 20 }} >
> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> </div>
</div> </button>}
</button> {this.state.get_for == 'edit' &&
<button <button
className="button" type="button"
type="button" onClick={() =>
disabled={this.state.editable} this.setState({ loading: true, editable: false }, () => {
style={{ setTimeout(() => {
backgroundColor: 'transparent', this.setState({ loading: false, buttonError: false, saveDraft: false })
cursor: this.state.editable === true ? 'default' : 'pointer', }, 100);
borderColor: 'transparent', })
outline: 'none', }
marginRight: 20 style={{ marginRight: 20 }}
}} >
onClick={() => this.setState({ loading: true }, () => { <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
setTimeout(() => { <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
this.createData("draft") </div>
}, 100); </button>}
})} {this.state.get_for == 'edit' &&
> <button
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> className="button"
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> type="button"
</div> // disabled={this.state.editable}
</button> style={{
<button backgroundColor: 'transparent',
type="button" cursor: 'pointer',
disabled={this.state.editable} borderColor: 'transparent',
onClick={() => this.setState({ loading: true }, () => { outline: 'none',
setTimeout(() => { marginRight: 20
this.createData("submitted") }}
}, 100); onClick={() =>
})} this.state.editable === true ?
style={{ this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
backgroundColor: 'transparent', :
cursor: this.state.editable === true ? 'default' : 'pointer', this.setState({ loading: true }, () => {
borderColor: 'transparent', setTimeout(() => {
outline: 'none', this.createData("draft")
marginRight: 20 }, 100);
}} })}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div> </div>
</button> </button>}
{this.state.get_for == 'edit' &&
<button
type="button"
// disabled={this.state.editable}
onClick={() =>
this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => {
this.createData("submitted")
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>}
</div>} </div>}
</div> </div>
</Paper> </Paper>
...@@ -2013,7 +2260,13 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2013,7 +2260,13 @@ export default class OperatingIndicatorRO extends Component {
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}
{
this.props.quartal === "q1" ? ' Q1 ' :
this.props.quartal === "q2" ? ' Q2 ' :
this.props.quartal === "q3" ? ' Q3 ' : ''
}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
...@@ -2029,7 +2282,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2029,7 +2282,7 @@ export default class OperatingIndicatorRO extends Component {
</div> </div>
)} )}
</div> </div>
<div className="grid grid-2x"> <div className="grid grid-2x" style={{ marginLeft: 10 }}>
<div className="col-1"> <div className="col-1">
<button <button
className="button" className="button"
...@@ -2057,7 +2310,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2057,7 +2310,7 @@ export default class OperatingIndicatorRO extends Component {
onClick={() => onClick={() =>
this.setState({ loading: true, editable: false }, () => { this.setState({ loading: true, editable: false }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: false }) this.setState({ loading: false, buttonError: false, saveDraft: false })
}, 100); }, 100);
}) })
} }
...@@ -2072,7 +2325,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2072,7 +2325,7 @@ export default class OperatingIndicatorRO extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -2080,7 +2333,9 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2080,7 +2333,9 @@ export default class OperatingIndicatorRO extends Component {
disabled={this.state.editable} disabled={this.state.editable}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ loading: true }, () => { this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadOI("draft") this.uploadOI("draft")
}, 100); }, 100);
...@@ -2094,7 +2349,8 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2094,7 +2349,8 @@ export default class OperatingIndicatorRO extends Component {
type="button" type="button"
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadOI("submitted") this.uploadOI("submitted")
...@@ -2103,7 +2359,7 @@ export default class OperatingIndicatorRO extends Component { ...@@ -2103,7 +2359,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={this.state.editable} disabled={this.state.editable}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
......
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