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