Commit 280ff81e authored by EKSAD's avatar EKSAD

puyeng

parent 1aa4afec
import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input } from '@material-ui/core';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
import api from '../../api';
......@@ -11,6 +11,15 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -34,7 +43,8 @@ export default class ProfitLoss extends Component {
dataTable: [],
visibleProfitLoss: true,
disabledSave: true,
editable: false
editable: false,
buttonError: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -130,7 +140,7 @@ export default class ProfitLoss extends Component {
}
}
})
this.setState({ dataTable, loading: false })
this.setState({ dataTable, loading: false, buttonError: true })
})
}
......@@ -225,28 +235,29 @@ export default class ProfitLoss extends Component {
let isi = resp.rows.slice(3)
console.log(isi);
let payload = []
let reg = /^\d+$/;
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
notes: i[2] === undefined ? "" : String(i[2]).trim(),
total_actual_before: i[3] === undefined ? "" : String(i[3]).trim(),
january: i[4] === undefined ? "" : String(i[4]).trim(),
february: i[5] === undefined ? "" : String(i[5]).trim(),
march: i[6] === undefined ? "" : String(i[6]).trim(),
april: i[7] === undefined ? "" : String(i[7]).trim(),
may: i[8] === undefined ? "" : String(i[8]).trim(),
june: i[9] === undefined ? "" : String(i[9]).trim(),
july: i[10] === undefined ? "" : String(i[10]).trim(),
august: i[11] === undefined ? "" : String(i[11]).trim(),
september: i[12] === undefined ? "" : String(i[12]).trim(),
october: i[13] === undefined ? "" : String(i[13]).trim(),
november: i[14] === undefined ? "" : String(i[14]).trim(),
december: i[15] === undefined ? "" : String(i[15]).trim(),
total_current_year: i[16] === undefined ? "" : String(i[16]).trim(),
total_next_year: i[17] === undefined ? "" : String(i[17]).trim(),
total_more_year: i[17] === undefined ? "" : String(i[18]).trim()
notes: i[2] === undefined ? "" : reg.test(String(i[2])) === false ? "" : String(i[2]).trim(),
total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
total_next_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
total_more_year: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim()
})
}
})
......@@ -256,15 +267,15 @@ export default class ProfitLoss extends Component {
report_id: this.props.report_id,
profit_loss: payload
}
// console.log(JSON.stringify(body))
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] })
}
});
}
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload));
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
......@@ -297,20 +308,16 @@ export default class ProfitLoss extends Component {
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
if (this.state.dataTable[23].length > 0) {
this.setState({ buttonError: true, errorPreview: true })
}
})
}
}
})
}
checkError(tableMeta) {
if (tableMeta.rowData[23]) {
if (tableMeta.rowData[23][0] === 'item') {
this.setState({ buttonError: true })
}
}
}
uploadProfitLoss() {
let data = []
this.state.dataTable.map(i => {
......@@ -348,7 +355,6 @@ export default class ProfitLoss extends Component {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
this.props.getReportAttachment()
} else {
alert(response.data.status)
}
......@@ -489,26 +495,11 @@ export default class ProfitLoss extends Component {
<div style={{ width: 300 }}>
{tableMeta.rowData[23] ?
tableMeta.rowData[23].length > 0 ?
tableMeta.rowData[23][0].field === 'item' ?
tableMeta.rowData[4] == 0 ?
<a data-tip={tableMeta.rowData[23][0].message} data-for="account">
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
{this.checkError(tableMeta)}
</a>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<a data-tip={tableMeta.rowData[23][0].message} data-for="account">
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
{this.checkError(tableMeta)}
</a>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
<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>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
......@@ -524,7 +515,6 @@ export default class ProfitLoss extends Component {
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
}
<ReactTooltip border={true} id="account" place="bottom" type="light" effect="solid" />
</div>
)
}
......@@ -637,18 +627,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -679,7 +670,6 @@ export default class ProfitLoss extends Component {
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
......@@ -725,18 +715,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -813,18 +804,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -901,18 +893,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -989,18 +982,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1077,18 +1071,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1165,18 +1160,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1253,18 +1249,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1341,18 +1338,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1429,18 +1427,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1502,7 +1501,6 @@ export default class ProfitLoss extends Component {
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
:
......@@ -1514,23 +1512,23 @@ export default class ProfitLoss extends Component {
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1607,18 +1605,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1695,18 +1694,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1783,18 +1783,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -1871,25 +1872,26 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
}
}
}, {
name: "31 Dec 2023 Total",
name: "31 Dec 2022 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -1959,18 +1961,19 @@ export default class ProfitLoss extends Component {
null
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
<span>validasi</span>
null
}
</div>
)
......@@ -2005,13 +2008,13 @@ export default class ProfitLoss extends Component {
{this.state.visibleProfitLoss === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Profit & Loss</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Profit & Loss </Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
......@@ -2067,7 +2070,7 @@ export default class ProfitLoss extends Component {
</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 && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -2114,40 +2117,40 @@ export default class ProfitLoss extends Component {
</div>
</button>
<button
className="button"
type="button"
disabled={this.state.disabledSave}
onClick={() => this.backToMasterBudget('submitted')}
style={{
backgroundColor: 'transparent',
cursor: this.state.disabledSave === true ? 'default' : 'pointer',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
}, 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</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
disabled={this.state.buttonError}
onClick={() => this.backToMasterBudget('submitted')}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, disabledSave: false, editable: true })
}, 100);
})
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div>
</button>
</div>
......@@ -2184,33 +2187,20 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError == true ? true : false}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss()
}, 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>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none'
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
}, 100);
})
}}
......@@ -2219,6 +2209,19 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss()
}, 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</Typography>
</div>
</button>
</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