Commit b80f54fc authored by Riri Novita's avatar Riri Novita

issue upload bspl

parent b1e26048
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core' import { createMuiTheme, FormControlLabel, Input, Snackbar, 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';
...@@ -11,6 +11,7 @@ import UploadFile from "../../library/Upload"; ...@@ -11,6 +11,7 @@ import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
import * as R from 'ramda'; import * as R from 'ramda';
import { Alert } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -266,8 +267,9 @@ export default class BalanceSheetMR extends Component { ...@@ -266,8 +267,9 @@ export default class BalanceSheetMR extends Component {
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(), item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(), item_report: i[2] === undefined ? "" : String(i[2]).trim(),
actual: i[3] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[3]).trim(), actual: i[3] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[3]).trim(),
mtd_vs_previous_month: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(), mtd_vs_previous_month: i[4] === undefined ? "" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(), mtd_vs_mb: i[5] === undefined ? "" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "" : String(i[6]).trim(),
}) })
} }
}) })
...@@ -316,9 +318,9 @@ export default class BalanceSheetMR extends Component { ...@@ -316,9 +318,9 @@ export default class BalanceSheetMR extends Component {
0, 0,
0, 0,
0, 0,
item.mtd_vs_previous_month === "" ? "" : item.mtd_vs_previous_month, item.mtd_vs_previous_month,
item.mtd_vs_mb === "" ? "" : item.mtd_vs_mb, item.mtd_vs_mb,
item.mtd_vs_rb === "" ? "" : item.mtd_vs_rb === null ? '' : item.mtd_vs_rb, item.mtd_vs_rb,
item.actual_formula, item.actual_formula,
item.order, item.order,
item.error item.error
...@@ -356,9 +358,9 @@ export default class BalanceSheetMR extends Component { ...@@ -356,9 +358,9 @@ export default class BalanceSheetMR extends Component {
percent_act_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)), percent_act_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
amount_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)), amount_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
percent_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)), percent_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
mtd_vs_previous_month: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)), mtd_vs_previous_month: String(i[17]),
mtd_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)), mtd_vs_mb: String(i[18]),
mtd_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[19].value).toFixed(1)) : i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)) mtd_vs_rb: String(i[19])
}) })
}) })
let body = { let body = {
...@@ -521,6 +523,10 @@ export default class BalanceSheetMR extends Component { ...@@ -521,6 +523,10 @@ export default class BalanceSheetMR extends Component {
}) })
} }
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleText = (value, tableMeta, type) => { const handleText = (value, tableMeta, type) => {
...@@ -1697,6 +1703,11 @@ export default class BalanceSheetMR extends Component { ...@@ -1697,6 +1703,11 @@ export default class BalanceSheetMR extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div> </div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}> {this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
...@@ -1912,7 +1923,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1912,7 +1923,7 @@ export default class BalanceSheetMR 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={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{/* {!this.state.loading && ( */} {this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
...@@ -1920,7 +1931,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1920,7 +1931,7 @@ export default class BalanceSheetMR extends Component {
options={options} options={options}
/> />
</MuiThemeProvider> </MuiThemeProvider>
{/* )} */} )}
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1">
...@@ -2046,7 +2057,7 @@ export default class BalanceSheetMR extends Component { ...@@ -2046,7 +2057,7 @@ export default class BalanceSheetMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => { onUpload={() => {
String(this.state.judul).includes("MONTHLY REPORT - BALANCE SHEET") ? String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
this.checkUpload() : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}} }}
......
...@@ -603,6 +603,7 @@ export default class ProfitLossMR extends Component { ...@@ -603,6 +603,7 @@ export default class ProfitLossMR extends Component {
const handleText = (value, tableMeta, type) => { const handleText = (value, tableMeta, type) => {
// dataTable2[tableMeta.rowIndex][type] = value // dataTable2[tableMeta.rowIndex][type] = value
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
console.log(dataTable2);
// console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
} }
const handleChange = (value, tableMeta, type) => { const handleChange = (value, tableMeta, type) => {
...@@ -829,19 +830,20 @@ export default class ProfitLossMR extends Component { ...@@ -829,19 +830,20 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null : {tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={tableMeta.rowData[6]}
control={ control={
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
inputProps={{style: {
color: "#5198ea"
}}}
placeholder="" placeholder=""
value={tableMeta.rowData[6]} // value={tableMeta.rowData[6]}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={tableMeta.rowData[6]} defaultValue={tableMeta.rowData[6]}
inputProps={{
style: {
color: "#5198ea"
}
}}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleText(event.target.value, tableMeta, 0) handleText(event.target.value, tableMeta, 0)
...@@ -1574,7 +1576,7 @@ export default class ProfitLossMR extends Component { ...@@ -1574,7 +1576,7 @@ export default class ProfitLossMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={false}
// value={tableMeta.rowData[19]} value={tableMeta.rowData[19]}
defaultValue={tableMeta.rowData[19]} defaultValue={tableMeta.rowData[19]}
inputProps={{ inputProps={{
style: { style: {
...@@ -1762,6 +1764,11 @@ export default class ProfitLossMR extends Component { ...@@ -1762,6 +1764,11 @@ export default class ProfitLossMR extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report Submission</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report Submission</Typography>
</div> </div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visiblePLMR ? {this.state.visiblePLMR ?
<Paper style={{ paddingTop: 10 }}> <Paper style={{ paddingTop: 10 }}>
...@@ -1978,7 +1985,7 @@ export default class ProfitLossMR extends Component { ...@@ -1978,7 +1985,7 @@ export default class ProfitLossMR 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={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{/* {!this.state.loading && ( */} {this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
...@@ -1986,7 +1993,7 @@ export default class ProfitLossMR extends Component { ...@@ -1986,7 +1993,7 @@ export default class ProfitLossMR extends Component {
options={options} options={options}
/> />
</MuiThemeProvider> </MuiThemeProvider>
{/* )} */} )}
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1">
......
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