Commit 03e6e30d authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

apdet

See merge request !1297
parents 60b1d4c8 c72dc7e0
......@@ -256,6 +256,11 @@ const create = (type = "") => {
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 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_rolling_outlook', body)
const getLastestUpdateROOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_latest_update', body)
//REPORT NEW
......@@ -728,7 +733,12 @@ const create = (type = "") => {
getRollingOutlookRevision,
getRollingOutlookIsApprover,
checkImportRollingOutlookBS,
importRollingOutlookBS
importRollingOutlookBS,
getRollingOI,
getHierarkiRollingOI,
createRollingOI,
getLastestUpdateROOI
}
}
......
......@@ -190,7 +190,7 @@ export default class OperatingIndicator extends Component {
})
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 = {
......@@ -343,13 +343,17 @@ export default class OperatingIndicator extends Component {
})
} 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({
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
visibleDetailRolling: true,
quartal: quarter
})
} else {
......@@ -421,7 +425,7 @@ export default class OperatingIndicator extends Component {
}
saveRollingOI(payload) {
api.create().createMonthlyReportOI(payload).then((response) => {
api.create().createRollingOI(payload).then((response) => {
console.log(response);
this.getReport()
this.getOperatingID()
......@@ -504,10 +508,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>
......@@ -640,7 +644,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getOperatingID()}
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 }}
/>
}
......@@ -658,7 +662,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getOperatingID()}
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 }}
/>
}
......@@ -669,7 +673,7 @@ export default class OperatingIndicator extends Component {
data={this.state.dataDetail}
height={this.props.height}
width={this.props.width}
months={this.state.months}
quartal={this.state.quartal}
company={this.state.company}
onClickClose={() => this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID()
......@@ -677,7 +681,7 @@ export default class OperatingIndicator extends Component {
})}
getReport={() => this.getOperatingID()}
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 }}
/>
}
......
......@@ -1481,7 +1481,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1612,7 +1612,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1743,7 +1743,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1874,7 +1874,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -2005,7 +2005,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -2136,7 +2136,7 @@ export default class BalanceSheetRO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......
......@@ -11,6 +11,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import Constant from '../../library/Constant';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -41,64 +42,115 @@ export default class OperatingIndicatorRO extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [
// ["TOTAL ASSETS", "11,247,249", "10,702,196"],
// ["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"],
],
dataTable: [],
loading: true,
visibleOI: true,
updateBy: '-',
notesUpdate: '-',
disabledSave: true,
editable: true,
emptyData: false,
templateNull: true
templateNull: true,
judulColumn: null,
saveDraft: true,
viewOnly: true,
get_for: 'view'
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
}
componentDidMount() {
this.getOperatingIDRolling()
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() {
let payload = {
"operating_indicator_id": this.props.data.operatingIndID,
"operating_indicator_id": this.state.operatingIndIDRolling,
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"quartal": this.props.quartal
}
api.create().getLastestUpdateOI(payload).then(response => {
// // console.log(response.data)
// console.log(payload);
api.create().getLastestUpdateROOI(payload).then(response => {
// console.log(response.data)
if (response.data) {
if (response.data.status === "success") {
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);
}
})
}
componentDidMount() {
// this.getItemHierarki()
this.getDataDetail()
this.getLatestUpdate()
// // console.log(this.props);
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
getDataDetail() {
this.setState({ loading: true })
let payload = {
"operating_indicator_id": this.props.data.operatingIndID,
"operating_indicator_id": this.state.operatingIndIDRolling,
"report_id": this.props.data.report_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)
api.create().getOperatingIndDetail(payload).then(response => {
api.create().getHierarkiRollingOI(payload).then(response => {
console.log(response)
let dataTable = []
let res = response.data.data
......@@ -114,20 +166,19 @@ export default class OperatingIndicatorRO extends Component {
item.level,
item.description,
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.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.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.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.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.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.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.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.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.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.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.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.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.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.rolling_outlook.january === "" ? "0" : item.rolling_outlook.january,
item.rolling_outlook.february === "" ? "0" : item.rolling_outlook.february,
item.rolling_outlook.march === "" ? "0" : item.rolling_outlook.march,
item.rolling_outlook.april === "" ? "0" : item.rolling_outlook.april,
item.rolling_outlook.may === "" ? "0" : item.rolling_outlook.may,
item.rolling_outlook.june === "" ? "0" : item.rolling_outlook.june,
item.rolling_outlook.july === "" ? "0" : item.rolling_outlook.july,
item.rolling_outlook.august === "" ? "0" : item.rolling_outlook.august,
item.rolling_outlook.september === "" ? "0" : item.rolling_outlook.september,
item.rolling_outlook.october === "" ? "0" : item.rolling_outlook.october,
item.rolling_outlook.november === "" ? "0" : item.rolling_outlook.november,
item.rolling_outlook.december === "" ? "0" : item.rolling_outlook.december,
item.rolling_outlook.total_current_year === "" ? "0" : item.rolling_outlook.total_current_year,
item.order
])
}
......@@ -148,20 +199,19 @@ export default class OperatingIndicatorRO extends Component {
item.level,
item.description,
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.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.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.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.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.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.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.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.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.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.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.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.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.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.rolling_outlook.january === "" ? "0" : item.rolling_outlook.january,
item.rolling_outlook.february === "" ? "0" : item.rolling_outlook.february,
item.rolling_outlook.march === "" ? "0" : item.rolling_outlook.march,
item.rolling_outlook.april === "" ? "0" : item.rolling_outlook.april,
item.rolling_outlook.may === "" ? "0" : item.rolling_outlook.may,
item.rolling_outlook.june === "" ? "0" : item.rolling_outlook.june,
item.rolling_outlook.july === "" ? "0" : item.rolling_outlook.july,
item.rolling_outlook.august === "" ? "0" : item.rolling_outlook.august,
item.rolling_outlook.september === "" ? "0" : item.rolling_outlook.september,
item.rolling_outlook.october === "" ? "0" : item.rolling_outlook.october,
item.rolling_outlook.november === "" ? "0" : item.rolling_outlook.november,
item.rolling_outlook.december === "" ? "0" : item.rolling_outlook.december,
item.rolling_outlook.total_current_year === "" ? "0" : item.rolling_outlook.total_current_year,
item.order
])
if (item.children !== null) {
......@@ -172,7 +222,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) {
this.setState({ emptyData: true })
}
......@@ -183,38 +233,38 @@ export default class OperatingIndicatorRO extends Component {
}
createData(type) {
let payloadMB = []
let payloadRO = []
this.state.dataTable.map((item, index) => {
payloadMB.push({
payloadRO.push({
"item_report_id": item[1],
"total_actual_before": String(Number(item[7]).toFixed(1)),
"january": String(Number(item[8]).toFixed(1)),
"february": String(Number(item[9]).toFixed(1)),
"march": String(Number(item[10]).toFixed(1)),
"april": String(Number(item[11]).toFixed(1)),
"may": String(Number(item[12]).toFixed(1)),
"june": String(Number(item[13]).toFixed(1)),
"july": String(Number(item[14]).toFixed(1)),
"august": String(Number(item[15]).toFixed(1)),
"september": String(Number(item[16]).toFixed(1)),
"october": String(Number(item[17]).toFixed(1)),
"november": String(Number(item[18]).toFixed(1)),
"december": String(Number(item[19]).toFixed(1)),
"total_current_year": String(Number(item[20]).toFixed(1)),
"january": String(Number(item[7]).toFixed(1)),
"february": String(Number(item[8]).toFixed(1)),
"march": String(Number(item[9]).toFixed(1)),
"april": String(Number(item[10]).toFixed(1)),
"may": String(Number(item[11]).toFixed(1)),
"june": String(Number(item[12]).toFixed(1)),
"july": String(Number(item[13]).toFixed(1)),
"august": String(Number(item[14]).toFixed(1)),
"september": String(Number(item[15]).toFixed(1)),
"october": String(Number(item[16]).toFixed(1)),
"november": String(Number(item[17]).toFixed(1)),
"december": String(Number(item[18]).toFixed(1)),
"total_current_year": String(Number(item[19]).toFixed(1)),
})
})
let payload = {
"operating_indicator_id": this.props.data.operatingIndID,
"operating_indicator_id": this.state.operatingIndIDRolling,
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"quartal": this.props.quartal,
"status": type,
"master_budget": payloadMB
"rolling_outlook": payloadRO
}
console.log(payload);
// // console.log('=========================')
// console.log(JSON.stringify(payload))
this.props.saveOperatingInd(payload)
this.props.saveRollingOI(payload)
this.props.onClickClose()
}
......@@ -283,7 +333,7 @@ export default class OperatingIndicatorRO extends Component {
downloadTemplate = async () => {
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()
// // console.log(res)
......@@ -301,7 +351,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]
// // console.log(bram)
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()
......@@ -356,7 +406,7 @@ export default class OperatingIndicatorRO extends Component {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
master_budget: payload,
rolling_outlook: payload,
status: 'submitted'
}
console.log(body)
......@@ -405,7 +455,7 @@ export default class OperatingIndicatorRO extends Component {
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 +490,7 @@ export default class OperatingIndicatorRO extends Component {
periode: this.props.data.periode,
report_id: this.props.data.report_id,
status: type,
master_budget: data
rolling_outlook: data
}
// // console.log(data);
// // console.log(JSON.stringify(body))
......@@ -527,7 +577,7 @@ export default class OperatingIndicatorRO extends Component {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
arrayFormulaConvert.push(opet == ''? Number(item) : Number(String(opet + String(item))))
arrayFormulaConvert.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
......@@ -601,7 +651,7 @@ export default class OperatingIndicatorRO extends Component {
name: "Account",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -681,7 +731,7 @@ export default class OperatingIndicatorRO extends Component {
name: "UOM",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -689,9 +739,27 @@ export default class OperatingIndicatorRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<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
:
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
style={{ margin: 0 }}
// value={value}
......@@ -722,7 +790,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Jan ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -730,9 +798,20 @@ export default class OperatingIndicatorRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<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
:
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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -767,9 +846,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -783,16 +860,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -808,7 +884,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Feb ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -819,6 +895,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -853,9 +940,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -869,16 +954,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -893,7 +977,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Mar ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -904,6 +988,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -938,9 +1033,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -954,16 +1047,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -978,7 +1070,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Apr ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -989,6 +1081,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1023,9 +1126,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1039,16 +1140,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quartal == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={this.props.quartal == 'q1'? false : true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1063,7 +1163,7 @@ export default class OperatingIndicatorRO extends Component {
name: `May ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1074,6 +1174,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1108,9 +1219,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1124,16 +1233,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quartal == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={this.props.quartal == 'q1'? false : true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1148,7 +1256,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Jun ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1159,6 +1267,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1193,9 +1312,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1209,16 +1326,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quartal == 'q1'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={this.props.quartal == 'q1'? false : true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1233,7 +1349,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Jul ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1244,6 +1360,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1278,9 +1405,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1294,16 +1419,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quartal == 'q1' || this.props.quartal == 'q2'? "#5198ea" : '#555252' , fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={this.props.quartal == 'q1' || this.props.quartal == 'q2'? false : true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1318,7 +1442,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Aug ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1329,6 +1453,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1363,9 +1498,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1379,16 +1512,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quartal == 'q1' || this.props.quartal == 'q2'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={this.props.quartal == 'q1' || this.props.quartal == 'q2'? false : true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1403,7 +1535,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Sep ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1414,6 +1546,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1448,9 +1591,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1464,16 +1605,15 @@ export default class OperatingIndicatorRO extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.quartal == 'q1' || this.props.quartal == 'q2'? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={this.props.quartal == 'q1' || this.props.quartal == 'q2'? false : true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1488,7 +1628,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Oct ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1499,6 +1639,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1533,9 +1684,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1554,11 +1703,10 @@ export default class OperatingIndicatorRO extends Component {
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={false}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1573,7 +1721,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Nov ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1584,6 +1732,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1618,9 +1777,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1639,11 +1796,10 @@ export default class OperatingIndicatorRO extends Component {
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={false}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1658,7 +1814,7 @@ export default class OperatingIndicatorRO extends Component {
name: `Dec ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -1669,6 +1825,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1703,9 +1870,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1724,11 +1889,10 @@ export default class OperatingIndicatorRO extends Component {
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={false}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1740,7 +1904,7 @@ export default class OperatingIndicatorRO extends Component {
}
}
}, {
name: `31 Dec ${this.props.data.periode}\nTotal`,
name: `31 Dec ${this.props.data.periode} Total`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -1754,6 +1918,17 @@ export default class OperatingIndicatorRO extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 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 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1788,9 +1963,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1809,11 +1982,10 @@ export default class OperatingIndicatorRO extends Component {
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
disabled={false}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
......@@ -1863,12 +2035,18 @@ export default class OperatingIndicatorRO extends Component {
{!this.state.emptyData && <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<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>
</div>
<div style={{ width: '50%' }}>
<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
style={{
backgroundColor: 'transparent',
......@@ -1882,7 +2060,7 @@ export default class OperatingIndicatorRO extends Component {
</button>
</a>}
<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
style={{
backgroundColor: 'transparent',
......@@ -1916,6 +2094,7 @@ export default class OperatingIndicatorRO extends Component {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading &&
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -1923,11 +2102,13 @@ export default class OperatingIndicatorRO extends Component {
options={options}
/>
</MuiThemeProvider>
}
</div>
<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 className="grid grid-2x">
<div className="col-1">
<div className="col-1" style={{ paddingLeft: 20 }}>
<button
className="button"
type="button"
......@@ -1947,13 +2128,28 @@ export default class OperatingIndicatorRO extends Component {
</div>
</button>
</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 }}>
{this.state.get_for == 'view' && this.state.viewOnly &&
<button
type="button"
onClick={() => {
this.setState({loading: true}, () => {
this.handleGetFor('edit')
})
}}
style={{ marginRight: 21 }}
>
<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>
</div>
</button>}
{this.state.get_for == 'edit' &&
<button
type="button"
onClick={() =>
this.setState({ loading: true, editable: false }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
this.setState({ loading: false, buttonError: false, saveDraft: false })
}, 100);
})
}
......@@ -1962,19 +2158,24 @@ export default class OperatingIndicatorRO extends Component {
<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' }}>Calculate</Typography>
</div>
</button>
</button>}
{this.state.get_for == 'edit' &&
<button
className="button"
type="button"
disabled={this.state.editable}
// disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ loading: true }, () => {
onClick={() =>
this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => {
this.createData("draft")
}, 100);
......@@ -1983,11 +2184,16 @@ export default class OperatingIndicatorRO extends Component {
<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 as Draft</Typography>
</div>
</button>
</button>}
{this.state.get_for == 'edit' &&
<button
type="button"
disabled={this.state.editable}
onClick={() => this.setState({ loading: true }, () => {
// 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);
......@@ -2003,7 +2209,7 @@ export default class OperatingIndicatorRO extends Component {
<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>
</button>}
</div>}
</div>
</Paper>
......@@ -2013,7 +2219,13 @@ export default class OperatingIndicatorRO extends Component {
<div style={{ padding: 25 }}>
<div>
<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>
</div>
{this.state.dataLoaded && (
......@@ -2029,7 +2241,7 @@ export default class OperatingIndicatorRO extends Component {
</div>
)}
</div>
<div className="grid grid-2x">
<div className="grid grid-2x" style={{ marginLeft: 10 }}>
<div className="col-1">
<button
className="button"
......@@ -2057,7 +2269,7 @@ export default class OperatingIndicatorRO extends Component {
onClick={() =>
this.setState({ loading: true, editable: false }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
this.setState({ loading: false, buttonError: false, saveDraft: false })
}, 100);
})
}
......@@ -2072,7 +2284,7 @@ export default class OperatingIndicatorRO extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
......@@ -2080,7 +2292,9 @@ export default class OperatingIndicatorRO extends Component {
disabled={this.state.editable}
onClick={() =>
this.state.editable === true ?
null : this.setState({ loading: true }, () => {
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("draft")
}, 100);
......@@ -2094,7 +2308,8 @@ export default class OperatingIndicatorRO extends Component {
type="button"
onClick={() =>
this.state.editable === true ?
null :
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("submitted")
......@@ -2103,7 +2318,7 @@ export default class OperatingIndicatorRO extends Component {
disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
......
......@@ -1343,7 +1343,7 @@ export default class ProfitLossROO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1441,7 +1441,7 @@ export default class ProfitLossROO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1539,7 +1539,7 @@ export default class ProfitLossROO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1'? true : false}
disabled={this.props.quarter == 'q1'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1637,7 +1637,7 @@ export default class ProfitLossROO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1735,7 +1735,7 @@ export default class ProfitLossROO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1833,7 +1833,7 @@ export default class ProfitLossROO extends Component {
type="text"
placeholder=""
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? true : false}
disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
value={Number(val).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......
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