Commit cc68ef05 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'faisal' into 'master'

update fam preview upload

See merge request !390
parents bc515672 f0e9a94f
......@@ -3,8 +3,6 @@ import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormCon
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
import api from '../../api';
import AddIcon from '@material-ui/icons/Add';
import { values } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
......@@ -87,9 +85,8 @@ export default class FixedAssetsMovement extends Component {
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
// console.log(payload);
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -220,7 +217,6 @@ export default class FixedAssetsMovement extends Component {
total_next_year: String(Number(i[20]).toFixed(1)),
total_more_year: String(Number(i[21]).toFixed(1))
})
})
let payload = {
"submission_id": this.props.submissionID,
......@@ -287,12 +283,10 @@ export default class FixedAssetsMovement extends Component {
}
})
let body = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
fixed_asset_movement: payload
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
......@@ -337,7 +331,7 @@ export default class FixedAssetsMovement extends Component {
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.state.dataTable.map(item => {
if (item[22].length > 0) {
if (item[23].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true })
}
......@@ -354,22 +348,22 @@ export default class FixedAssetsMovement extends Component {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
total_actual_before: String(Number(i[6]).toFixed(1)),
january: String(Number(i[7]).toFixed(1)),
february: String(Number(i[8]).toFixed(1)),
march: String(Number(i[9]).toFixed(1)),
april: String(Number(i[10]).toFixed(1)),
may: String(Number(i[11]).toFixed(1)),
june: String(Number(i[12]).toFixed(1)),
july: String(Number(i[13]).toFixed(1)),
august: String(Number(i[14]).toFixed(1)),
september: String(Number(i[15]).toFixed(1)),
october: String(Number(i[16]).toFixed(1)),
november: String(Number(i[17]).toFixed(1)),
december: String(Number(i[18]).toFixed(1)),
total_current_year: String(Number(i[19]).toFixed(1)),
total_next_year: String(Number(i[20]).toFixed(1)),
total_more_year: String(Number(i[21]).toFixed(1))
})
})
let body = {
......@@ -380,7 +374,7 @@ export default class FixedAssetsMovement extends Component {
fixed_asset_movement: data,
status: type
}
console.log(data);
// console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
console.log(response);
if (response.data) {
......@@ -391,6 +385,7 @@ export default class FixedAssetsMovement extends Component {
alert(response.data.status)
}
} else {
this.setState({ loading: false })
alert(response.problem)
}
})
......@@ -415,7 +410,7 @@ export default class FixedAssetsMovement extends Component {
handleValidate() {
let data = []
console.log(this.state.dataTable)
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -446,7 +441,6 @@ export default class FixedAssetsMovement extends Component {
"fixed_asset_movement": data,
"status": "submitted"
}
// console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
......@@ -465,7 +459,6 @@ export default class FixedAssetsMovement extends Component {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
if (type === "actual") {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} else {
......@@ -556,7 +549,7 @@ export default class FixedAssetsMovement extends Component {
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
......@@ -647,9 +640,8 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{/* {console.log(tableMeta.rowData)} */}
{tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ?
{tableMeta.rowData[23] ?
tableMeta.rowData[23].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
......@@ -2202,20 +2194,24 @@ export default class FixedAssetsMovement extends Component {
</div>
)}
</div>
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ visibleFixedAssetsMovement: true }, () => {
onClick={() => this.setState({ loading: true, visibleFixedAssetsMovement: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
......@@ -2235,7 +2231,7 @@ export default class FixedAssetsMovement extends Component {
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
......@@ -2244,14 +2240,29 @@ export default class FixedAssetsMovement extends Component {
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadFAM()
this.uploadFAM('draft')
}, 100);
})}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadFAM('submitted')
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div>
</div>
</Paper>}
......
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