Commit 4d60afdf authored by Deni Rinaldi's avatar Deni Rinaldi

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

parents 5ce5fffb 8d006290
import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core' import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react' import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
...@@ -152,16 +152,16 @@ export default class BalanceSheetMR extends Component { ...@@ -152,16 +152,16 @@ export default class BalanceSheetMR extends Component {
item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget, item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget, item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual, item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "0" : item.balance_sheet.actual_previous_month === "" ? "0" : item.balance_sheet.actual_previous_month, item.balance_sheet.actual_previous_month === null ? "5.0" : item.balance_sheet.actual_previous_month === "" ? "5.0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month, item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month, item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb, item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb, item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb, item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb, item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "0" : item.balance_sheet.mtd_vs_previous_month, item.balance_sheet.mtd_vs_previous_month === "" ? null : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "0" : item.balance_sheet.mtd_vs_mb, item.balance_sheet.mtd_vs_mb === "" ? null : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "0" : item.balance_sheet.mtd_vs_rb, item.balance_sheet.mtd_vs_rb === "" ? null : item.balance_sheet.mtd_vs_rb,
item.balance_sheet.actual_formula, item.balance_sheet.actual_formula,
item.order item.order
]) ])
...@@ -186,16 +186,16 @@ export default class BalanceSheetMR extends Component { ...@@ -186,16 +186,16 @@ export default class BalanceSheetMR extends Component {
item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget, item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget, item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual, item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "0" : item.balance_sheet.actual_previous_month === "" ? "0" : item.balance_sheet.actual_previous_month, item.balance_sheet.actual_previous_month === null ? "5.0" : item.balance_sheet.actual_previous_month === "" ? "5.0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month, item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month, item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb, item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb, item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb, item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb, item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "0" : item.balance_sheet.mtd_vs_previous_month, item.balance_sheet.mtd_vs_previous_month === "" ? null : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "0" : item.balance_sheet.mtd_vs_mb, item.balance_sheet.mtd_vs_mb === "" ? null : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "0" : item.balance_sheet.mtd_vs_rb, item.balance_sheet.mtd_vs_rb === "" ? null : item.balance_sheet.mtd_vs_rb,
item.balance_sheet.actual_formula, item.balance_sheet.actual_formula,
item.order item.order
]) ])
...@@ -207,9 +207,9 @@ export default class BalanceSheetMR extends Component { ...@@ -207,9 +207,9 @@ export default class BalanceSheetMR extends Component {
} }
} }
}) })
console.log(dataTable);
this.setState({ dataTable, loading: false }) this.setState({ dataTable, loading: false })
} }
console.log(dataTable);
}) })
} }
...@@ -498,7 +498,12 @@ export default class BalanceSheetMR extends Component { ...@@ -498,7 +498,12 @@ export default class BalanceSheetMR extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleText = (value, tableMeta, type) => {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleChange = (value, tableMeta, type) => { const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
if (type === "actual") { if (type === "actual") {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1) dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
...@@ -1489,164 +1494,86 @@ export default class BalanceSheetMR extends Component { ...@@ -1489,164 +1494,86 @@ export default class BalanceSheetMR extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
Number(tableMeta.rowData[12]) <= this.state.minValue || Number(tableMeta.rowData[12]) >= this.state.maxValue ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={tableMeta.rowData[17]} // value={value}
control={ control={
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={Number(tableMeta.rowData[12]) <= this.state.minValue || Number(tableMeta.rowData[12]) >= this.state.maxValue ? false : true}
value={Number(tableMeta.rowData[17]).toFixed(1)} defaultValue={tableMeta.rowData[17]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 7)
}} }}
/> />
} }
/> />}
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[17]).toFixed(1)}
/>
}
/>
</div> </div>
}
</div> </div>
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={tableMeta.rowData[18]} // value={value}
control={ control={
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
value={Number(tableMeta.rowData[18]).toFixed(1)} defaultValue={tableMeta.rowData[18]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 8)
}} }}
/> />
} }
/> />}
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 8)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
/>
}
/>
</div> </div>
}
</div> </div>
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={tableMeta.rowData[19]} // value={value}
control={ control={
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true}
value={Number(tableMeta.rowData[19]).toFixed(1)} defaultValue={tableMeta.rowData[19]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 9)
}} }}
/> />
} }
/> />}
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 9)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[19]).toFixed(1)}
/>
}
/>
</div> </div>
}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -1536,7 +1536,7 @@ export default class ProfitLossMR extends Component { ...@@ -1536,7 +1536,7 @@ export default class ProfitLossMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true} disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[20]} defaultValue={tableMeta.rowData[20]}
inputProps={{style: { inputProps={{style: {
color: "#5198ea", color: "#5198ea",
...@@ -1564,7 +1564,7 @@ export default class ProfitLossMR extends Component { ...@@ -1564,7 +1564,7 @@ export default class ProfitLossMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true} disabled={Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[21]} defaultValue={tableMeta.rowData[21]}
inputProps={{style: { inputProps={{style: {
color: "#5198ea", color: "#5198ea",
......
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