Commit 022d0081 authored by d.arizona's avatar d.arizona

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into didam

parents 1db3467f 4baee212
......@@ -1296,14 +1296,14 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ flex: 1, textAlign: 'right' }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)? "#5198ea" : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={ tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)) : Number(value).toFixed(1)}
value={ tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)).toFixed(1) : Number(value).toFixed(1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.state.get_for == 'view'? true : !handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)}
decimalScale={1}
......@@ -1336,7 +1336,7 @@ export default class CorporateAnnualTargetMR extends Component {
null :
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1381,14 +1381,14 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleAchiement(tableMeta)}
value={handleAchiement(tableMeta).toFixed(1)}
decimalScale={1}
disabled={true}
/>
......@@ -1426,7 +1426,7 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1479,7 +1479,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta)}
value={handleTotal(tableMeta).toFixed(1)}
decimalScale={2}
disabled={true}
/>
......
......@@ -89,7 +89,7 @@ export default class OperatingIndicatorMR extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null
"months": this.props.months
}
// console.log(payload);
api.create().getLastestUpdateMROI(payload).then(response => {
......@@ -124,7 +124,7 @@ export default class OperatingIndicatorMR extends Component {
}
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
......@@ -154,7 +154,7 @@ export default class OperatingIndicatorMR extends Component {
let payload = {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null
"months": this.props.months
}
api.create().getMonthlyOI(payload).then(response => {
// console.log(response);
......@@ -181,7 +181,7 @@ export default class OperatingIndicatorMR extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"months": this.props.months,
"get_for": this.state.get_for
}
// console.log(payload);
......@@ -214,7 +214,8 @@ export default class OperatingIndicatorMR extends Component {
item.description,
item.uom === "" ? null : item.uom,
item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
// item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
5,
item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
......@@ -254,7 +255,8 @@ export default class OperatingIndicatorMR extends Component {
item.description,
item.uom === "" ? null : item.uom,
item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
// item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
5,
item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
......@@ -302,10 +304,11 @@ export default class OperatingIndicatorMR extends Component {
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?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}&&months=${this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null}`
// console.log(this.props.months);
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?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}&&months=${this.props.months}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?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}&&months=${this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?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}&&months=${this.props.months}`
)
res = await res.blob()
this.setState({ loading: false })
......@@ -342,7 +345,7 @@ export default class OperatingIndicatorMR extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"status": type,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"months": this.props.months,
"monthly_report": data
}
console.log(payload);
......@@ -381,7 +384,7 @@ export default class OperatingIndicatorMR extends Component {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
months: this.props.months,
monthly_report: payload
}
console.log(body)
......@@ -460,7 +463,7 @@ export default class OperatingIndicatorMR extends Component {
periode: this.props.data.periode,
report_id: this.props.data.report_id,
status: type,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
months: this.props.months,
monthly_report: data
}
// console.log(body);
......@@ -517,7 +520,7 @@ export default class OperatingIndicatorMR extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"status": "submitted",
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"months": this.props.months,
"monthly_report": data
}
// console.log(JSON.stringify(payload));
......@@ -604,12 +607,10 @@ export default class OperatingIndicatorMR extends Component {
const handleVariancePercent = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
// total = Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])
total = R.equals((Number(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 ), NaN) ? '0' : R.equals((Number(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 ), Infinity) ? '0' : Number(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8]) * 100)
total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 2) {
// total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])
total = R.equals((Number(Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 ), NaN) ? '0' : R.equals((Number(Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 ), Infinity) ? '0' : Number(Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])* 100)
total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9]))* 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
......@@ -1209,11 +1210,11 @@ export default class OperatingIndicatorMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(tableMeta.rowData[12]).toFixed(1)}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
......@@ -1283,11 +1284,11 @@ export default class OperatingIndicatorMR extends Component {
<div style={{ flex: 1, width: 120 }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(tableMeta.rowData[14]).toFixed(1)}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
......@@ -1562,18 +1563,18 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>
Period : {
this.props.data.report_id === 22 ? 'JAN' :
this.props.data.report_id === 23 ? 'FEB' :
this.props.data.report_id === 24 ? 'MAR' :
this.props.data.report_id === 25 ? 'APR' :
this.props.data.report_id === 26 ? 'MAY' :
this.props.data.report_id === 27 ? 'JUN' :
this.props.data.report_id === 28 ? 'JUL' :
this.props.data.report_id === 29 ? 'AUG' :
this.props.data.report_id === 30 ? 'SEP' :
this.props.data.report_id === 31 ? 'OCT' :
this.props.data.report_id === 32 ? 'NOV' :
this.props.data.report_id === 33 ? 'DEC' : "" } {this.props.data.periode}
this.props.months === 1 ? 'JAN' :
this.props.months === 2 ? 'FEB' :
this.props.months === 3 ? 'MAR' :
this.props.months === 4 ? 'APR' :
this.props.months === 5 ? 'MAY' :
this.props.months === 6 ? 'JUN' :
this.props.months === 7 ? 'JUL' :
this.props.months === 8 ? 'AUG' :
this.props.months === 9 ? 'SEP' :
this.props.months === 10 ? 'OCT' :
this.props.months === 11 ? 'NOV' :
this.props.months === 12 ? 'DEC' : "" } {this.props.data.periode}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
......@@ -1750,18 +1751,18 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>
Period : {
this.props.data.report_id === 22 ? 'JAN' :
this.props.data.report_id === 23 ? 'FEB' :
this.props.data.report_id === 24 ? 'MAR' :
this.props.data.report_id === 25 ? 'APR' :
this.props.data.report_id === 26 ? 'MAY' :
this.props.data.report_id === 27 ? 'JUN' :
this.props.data.report_id === 28 ? 'JUL' :
this.props.data.report_id === 29 ? 'AUG' :
this.props.data.report_id === 30 ? 'SEP' :
this.props.data.report_id === 31 ? 'OCT' :
this.props.data.report_id === 32 ? 'NOV' :
this.props.data.report_id === 33 ? 'DEC' : "" } {this.props.data.periode}
this.props.months === 1 ? 'JAN' :
this.props.months === 2 ? 'FEB' :
this.props.months === 3 ? 'MAR' :
this.props.months === 4 ? 'APR' :
this.props.months === 5 ? 'MAY' :
this.props.months === 6 ? 'JUN' :
this.props.months === 7 ? 'JUL' :
this.props.months === 8 ? 'AUG' :
this.props.months === 9 ? 'SEP' :
this.props.months === 10 ? 'OCT' :
this.props.months === 11 ? 'NOV' :
this.props.months === 12 ? 'DEC' : "" } {this.props.data.periode}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
......@@ -1829,25 +1830,30 @@ export default class OperatingIndicatorMR extends Component {
}}
// disabled={this.state.editable}
onClick={() =>
this.state.editable === true ?
null : this.setState({ loading: true }, () => {
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("draft")
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.editable === true?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</LightTooltip>
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
}
</div>
</button>
<button
className="button"
type="button"
// disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
......@@ -1857,23 +1863,10 @@ export default class OperatingIndicatorMR extends Component {
this.uploadOI("submitted")
}, 100);
})}
// disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.editable === true ?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</LightTooltip>
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div>
</button>
</div>}
......
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