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

ropl

parent 3e88701f
......@@ -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_monthly_report', 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 }}
/>
}
......
......@@ -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,117 @@ 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.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() {
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 +168,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 == "" ? item.rolling_outlook.january : String(item.rolling_outlook.january).indexOf(".") == -1 ? Number(item.rolling_outlook.january) : Number(item.rolling_outlook.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.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.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.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.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.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.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.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.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.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.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.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.order
])
}
......@@ -148,20 +201,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 == "" ? item.rolling_outlook.january : String(item.rolling_outlook.january).indexOf(".") == -1 ? Number(item.rolling_outlook.january) : Number(item.rolling_outlook.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.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.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.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.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.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.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.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.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.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.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.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.order
])
if (item.children !== null) {
......@@ -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) {
this.setState({ emptyData: true })
}
......@@ -209,7 +261,7 @@ export default class OperatingIndicatorRO extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"status": type,
"master_budget": payloadMB
"rolling_outlook": payloadMB
}
console.log(payload);
// // console.log('=========================')
......@@ -283,7 +335,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 +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]
// // 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 +408,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 +457,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 +492,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 +579,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 = ""
}
......@@ -689,9 +741,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}
......@@ -730,9 +800,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
......@@ -819,6 +900,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
......@@ -904,6 +996,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
......@@ -989,6 +1092,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
......@@ -1074,6 +1188,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
......@@ -1159,6 +1284,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
......@@ -1244,6 +1380,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
......@@ -1329,6 +1476,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
......@@ -1414,6 +1572,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
......@@ -1499,6 +1668,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
......@@ -1584,6 +1764,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
......@@ -1669,6 +1860,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
......@@ -1754,6 +1956,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
......@@ -1863,12 +2076,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 +2101,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 +2135,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 +2143,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 +2169,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 +2199,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 +2225,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 +2250,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 +2260,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 +2282,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 +2310,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 +2325,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 +2333,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 +2349,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 +2359,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
......
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