Commit 819a7fe5 authored by Deni Rinaldi's avatar Deni Rinaldi

fam

parent e70541fc
...@@ -49,7 +49,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -49,7 +49,7 @@ export default class FixedAssetsMovementMR extends Component {
updateBy: '-', updateBy: '-',
notesUpdate: '-', notesUpdate: '-',
get_for: 'view', get_for: 'view',
viewOnly : true viewOnly: true
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -61,7 +61,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -61,7 +61,7 @@ export default class FixedAssetsMovementMR extends Component {
} }
handleGetFor(type) { handleGetFor(type) {
this.setState({get_for: type}, () => { this.setState({ get_for: type }, () => {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
}) })
...@@ -93,7 +93,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -93,7 +93,7 @@ export default class FixedAssetsMovementMR extends Component {
checkStatus = false checkStatus = false
} }
this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus}) this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus })
} }
getLatestUpdate() { getLatestUpdate() {
...@@ -201,10 +201,12 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -201,10 +201,12 @@ export default class FixedAssetsMovementMR extends Component {
} }
}) })
console.log(dataTable); console.log(dataTable);
this.setState({ dataTable }, () => { this.setState({ dataTable, loading: false, refresh: false }, () => {
this.setState({ loading: true, refresh: true })
setTimeout(() => { setTimeout(() => {
this.setState({loading: false, refresh: false}) this.setState({ loading: false, refresh: false })
}, 300); }, 200);
}) })
} 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 }, () => {
...@@ -484,7 +486,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -484,7 +486,7 @@ export default class FixedAssetsMovementMR extends Component {
// console.log(valuezz); // console.log(valuezz);
} }
} else { } else {
let data = tableMeta.rowData[13] == null? [] : tableMeta.rowData[13] let data = tableMeta.rowData[13] == null ? [] : tableMeta.rowData[13]
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`)) let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = data[indexID].value let valuezz = data[indexID].value
...@@ -507,7 +509,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -507,7 +509,7 @@ export default class FixedAssetsMovementMR extends Component {
if (item == '-' || item == '+' || item == '/' || item == '*') { if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item opet = item
} else { } else {
anjay.push(opet == ''? Number(item) : Number(String(opet + String(item)))) anjay.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false tambahan = false
opet = "" opet = ""
} }
...@@ -680,13 +682,13 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -680,13 +682,13 @@ export default class FixedAssetsMovementMR extends Component {
// console.log(tableMeta.rowData[9]); // console.log(tableMeta.rowData[9]);
// console.log(total) // console.log(total)
if (dex === 2) { if (dex === 2) {
total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[6]) == NaN? "0.0" : Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[6]) total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[6]) == NaN ? "0.0" : Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[6])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// console.log(tableMeta.rowData[8]); // console.log(tableMeta.rowData[8]);
// console.log(tableMeta.rowData[6]); // console.log(tableMeta.rowData[6]);
// console.log(total) // console.log(total)
} else if (dex === 3) { } else if (dex === 3) {
total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[7]) == NaN? "0.0" : Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[7]) total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[7]) == NaN ? "0.0" : Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[7])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// console.log(tableMeta.rowData[8]); // console.log(tableMeta.rowData[8]);
// console.log(tableMeta.rowData[7]); // console.log(tableMeta.rowData[7]);
...@@ -694,6 +696,8 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -694,6 +696,8 @@ export default class FixedAssetsMovementMR extends Component {
} }
// console.log(dex) // console.log(dex)
// console.log(Number(tableMeta.columnIndex) + Number(type)) // console.log(Number(tableMeta.columnIndex) + Number(type))
console.log(total);
console.log(dataTable2);
return total return total
} }
...@@ -803,7 +807,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -803,7 +807,7 @@ export default class FixedAssetsMovementMR extends Component {
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */} </TableCell> */}
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 45}}>{columnMeta.name}</div> <div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 45 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}> <div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'flex', justifyContent: 'center', alignItems: 'center' }}> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<span>{"Master Budget (MB)"}</span> <span>{"Master Budget (MB)"}</span>
...@@ -875,7 +879,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -875,7 +879,7 @@ export default class FixedAssetsMovementMR extends Component {
{ {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null : null :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} value={value}
...@@ -900,10 +904,10 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -900,10 +904,10 @@ export default class FixedAssetsMovementMR extends Component {
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={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' }}
style={{ color: this.props.isApprover || this.state.get_for == 'view'? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)} disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
value={Number(tableMeta.rowData[8]).toFixed(1)} value={Number(tableMeta.rowData[8]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 8) handleChange(event.target.value, tableMeta, 8)
...@@ -912,7 +916,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -912,7 +916,7 @@ export default class FixedAssetsMovementMR extends Component {
} }
/> />
</div> : </div> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -1000,7 +1004,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1000,7 +1004,7 @@ export default class FixedAssetsMovementMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
...@@ -1039,7 +1043,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1039,7 +1043,7 @@ export default class FixedAssetsMovementMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
...@@ -1085,7 +1089,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1085,7 +1089,7 @@ export default class FixedAssetsMovementMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
...@@ -1124,7 +1128,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1124,7 +1128,7 @@ export default class FixedAssetsMovementMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={val}
...@@ -1242,7 +1246,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1242,7 +1246,7 @@ export default class FixedAssetsMovementMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view'? {this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
...@@ -1273,7 +1277,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1273,7 +1277,7 @@ export default class FixedAssetsMovementMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.downloadTemplate() } onClick={() => this.downloadTemplate()}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
...@@ -1366,7 +1370,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1366,7 +1370,7 @@ export default class FixedAssetsMovementMR extends Component {
outline: 'none' outline: 'none'
}} }}
onClick={() => { onClick={() => {
this.setState({loading: true, refresh: true}, () => { this.setState({ loading: true, refresh: true }, () => {
this.handleGetFor('edit') this.handleGetFor('edit')
// setTimeout(() => { // setTimeout(() => {
// this.setState({ loading: false }) // this.setState({ loading: false })
......
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