Commit 6e6aa9f5 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

apdett

See merge request !898
parents 01adf920 7f397a4e
......@@ -53,7 +53,8 @@ export default class BalanceSheetMR extends Component {
updateBy: '-',
notes: "",
judulColumn: null,
get_for: "view"
get_for: "view",
kansas: 0
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -493,10 +494,12 @@ export default class BalanceSheetMR extends Component {
handleValidate() {
let data = []
let err = false
let errorContrl = this.state.buttonError
let errorContrl = false
let editAble = this.state.editAble
console.log(this.state.dataTable)
this.state.dataTable.map((i, index) => {
let dataTable = this.state.dataTable
let kansas = this.state.kansas
console.log(dataTable[dataTable.length-1])
dataTable.map((i, index) => {
if(i[0] === 3) {
// console.log(i);
if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
......@@ -513,15 +516,10 @@ export default class BalanceSheetMR extends Component {
}
if (String(i[5]) == "Control (should be nil)") {
i.map((j, indexj) => {
if (indexj >= 6 && indexj <= 16) {
if (Number(j) < this.state.minValue || Number(j) > this.state.maxValue ) {
console.log("masuk error")
errorContrl = true
editAble = true
}
}
})
if (Number(i[9]) < this.state.minValue || Number(i[9]) > this.state.maxValue ) {
errorContrl = true
editAble = true
}
}
data.push({
......@@ -584,8 +582,22 @@ export default class BalanceSheetMR extends Component {
if (response.data.status === "success") {
if (response.data.data.result && err === false && errorContrl === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
if (kansas == 0) {
this.setState({kansas: 1, loading: true}, () => {
this.handleValidate()
})
} else {
this.setState({kansas: 0})
}
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
if (kansas == 0) {
this.setState({kansas: 1, loading: true}, () => {
this.handleValidate()
})
} else {
this.setState({kansas: 0})
}
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -614,10 +626,10 @@ export default class BalanceSheetMR extends Component {
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
let val = String(value).split(",").join("")
if (type === "actual") {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
console.log(dataTable2);
} else {
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
......@@ -635,6 +647,7 @@ export default class BalanceSheetMR extends Component {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
}
}
console.log(dataTable2);
}
const handleValue = (data, type) => {
......@@ -1105,7 +1118,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
null :
this.state.get_for == 'view'?
// this.state.get_for == 'view'?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
......@@ -1114,35 +1127,35 @@ export default class BalanceSheetMR extends Component {
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
/>
:
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, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<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(handleValueFormula(tableMeta, 7)).toFixed(1)}
/>
}
/>
</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, 0)).toFixed(1)}
// />
// </span> :
// tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
// <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(handleValueFormula(tableMeta, 7)).toFixed(1)}
// />
// }
// />
// </div> :
// tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 7)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
......@@ -1179,22 +1192,22 @@ export default class BalanceSheetMR extends Component {
// />
// </LightTooltip>
// :
<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[7]).toFixed(1)}
/>
}
/>
</div>
// <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[7]).toFixed(1)}
// />
// }
// />
// </div>
}
</div>
</div>
......@@ -1202,7 +1215,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
null :
this.state.get_for == 'view'?
// this.state.get_for == 'view'?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
......@@ -1211,35 +1224,35 @@ export default class BalanceSheetMR extends Component {
disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
:
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, 1)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<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(handleValueFormula(tableMeta, 8)).toFixed(1)}
/>
}
/>
</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, 1)).toFixed(1)}
// />
// </span> :
// tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
// <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(handleValueFormula(tableMeta, 8)).toFixed(1)}
// />
// }
// />
// </div> :
// tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 8)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 8)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
......@@ -1276,22 +1289,22 @@ export default class BalanceSheetMR extends Component {
// />
// </LightTooltip>
// :
<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[8]).toFixed(1)}
/>
}
/>
</div>
// <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[8]).toFixed(1)}
// />
// }
// />
// </div>
}
</div>
</div>
......@@ -2045,9 +2058,9 @@ export default class BalanceSheetMR extends Component {
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
{tableMeta.rowData[0] !== 3 ?
null :
this.state.get_for == 'view'?
(this.state.get_for == 'view'?
tableMeta.rowData[17]
:
<FormControlLabel
......@@ -2134,15 +2147,15 @@ export default class BalanceSheetMR extends Component {
}}
/>
}
/>}
/>)}
</div>
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? null :
this.state.get_for == 'view'?
{tableMeta.rowData[0] !== 3 ? null :
(this.state.get_for == 'view'?
tableMeta.rowData[18]
:
<FormControlLabel
......@@ -2229,15 +2242,15 @@ export default class BalanceSheetMR extends Component {
}}
/>
}
/>}
/>)}
</div>
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? null :
this.state.get_for == 'view'?
{tableMeta.rowData[0] !== 3 ? null :
(this.state.get_for == 'view'?
tableMeta.rowData[19]
:
<FormControlLabel
......@@ -2324,7 +2337,7 @@ export default class BalanceSheetMR extends Component {
}}
/>
}
/>}
/>)}
</div>
</div>
</div>
......@@ -2571,7 +2584,7 @@ export default class BalanceSheetMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
......@@ -2689,7 +2702,7 @@ export default class BalanceSheetMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
......
......@@ -1275,7 +1275,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1) }
value={Number(tableMeta.rowData[23]).toFixed(1) }
/>
:
// tableMeta.rowData[0] === 2 ?
......
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