Commit a7e016d9 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'riri' into 'master'

apdet issue

See merge request !370
parents 10d4bf81 d84c78d7
......@@ -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, type } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
......@@ -46,7 +44,8 @@ export default class ProfitLoss extends Component {
disabledSave: true,
editable: false,
buttonError: false,
judulColumn: null
judulColumn: null,
updateBy: '-'
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -54,9 +53,29 @@ export default class ProfitLoss extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
console.log(this.props);
}
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
})
}
}
})
}
getItemHierarki() {
this.setState({ loading: true, judulColumn: null })
let payload = {
......@@ -71,7 +90,6 @@ export default class ProfitLoss extends Component {
let dataTable = []
if (response.data) {
let res = response.data.data
console.log(res)
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
......@@ -184,22 +202,22 @@ export default class ProfitLoss extends Component {
data.push({
item_report_id: i[1],
notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
total_actual_before: String(i[7]),
january: String(i[8]),
february: String(i[9]),
march: String(i[10]),
april: String(i[11]),
may: String(i[12]),
june: String(i[13]),
july: String(i[14]),
august: String(i[15]),
september: String(i[16]),
october: String(i[17]),
november: String(i[18]),
december: String(i[19]),
total_current_year: String(i[20]),
total_next_year: String(i[21]),
total_more_year: String(i[22])
total_actual_before: String(Number(i[7]).toFixed(1)),
january: String(Number(i[8]).toFixed(1)),
february: String(Number(i[9]).toFixed(1)),
march: String(Number(i[10]).toFixed(1)),
april: String(Number(i[11]).toFixed(1)),
may: String(Number(i[12]).toFixed(1)),
june: String(Number(i[13]).toFixed(1)),
july: String(Number(i[14]).toFixed(1)),
august: String(Number(i[15]).toFixed(1)),
september: String(Number(i[16]).toFixed(1)),
october: String(Number(i[17]).toFixed(1)),
november: String(Number(i[18]).toFixed(1)),
december: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1)),
total_next_year: String(Number(i[21]).toFixed(1)),
total_more_year: String(Number(i[22]).toFixed(1))
})
})
let payload = {
......@@ -210,7 +228,7 @@ export default class ProfitLoss extends Component {
"status": type,
"profit_loss": data
}
console.log(data);
// console.log(data);
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
......@@ -225,7 +243,7 @@ export default class ProfitLoss extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Profit Loss.xlsx';
a.download = 'Template Master Budget Profit & Loss.xlsx';
a.click();
}
}
......@@ -321,35 +339,35 @@ export default class ProfitLoss extends Component {
this.setState({ buttonError: true, errorPreview: true })
}
})
// console.log(dataTable)
// console.log(this.state.buttonError)
})
}
}
})
}
uploadProfitLoss() {
uploadProfitLoss(type) {
let data = []
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
notes: String(i[6]),
total_actual_before: String(i[7]),
january: String(i[8]),
february: String(i[9]),
march: String(i[10]),
april: String(i[11]),
may: String(i[12]),
june: String(i[13]),
july: String(i[14]),
august: String(i[15]),
september: String(i[16]),
october: String(i[17]),
november: String(i[18]),
december: String(i[19]),
total_current_year: String(i[20]),
total_next_year: String(i[21]),
total_more_year: String(i[22])
total_actual_before: String(Number(i[7]).toFixed(1)),
january: String(Number(i[8]).toFixed(1)),
february: String(Number(i[9]).toFixed(1)),
march: String(Number(i[10]).toFixed(1)),
april: String(Number(i[11]).toFixed(1)),
may: String(Number(i[12]).toFixed(1)),
june: String(Number(i[13]).toFixed(1)),
july: String(Number(i[14]).toFixed(1)),
august: String(Number(i[15]).toFixed(1)),
september: String(Number(i[16]).toFixed(1)),
october: String(Number(i[17]).toFixed(1)),
november: String(Number(i[18]).toFixed(1)),
december: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1)),
total_next_year: String(Number(i[21]).toFixed(1)),
total_more_year: String(Number(i[22]).toFixed(1)),
})
})
let body = {
......@@ -357,10 +375,10 @@ export default class ProfitLoss extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
profit_loss: data
profit_loss: data,
status: type
}
console.log(data);
// console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
console.log(response);
if (response.data) {
......@@ -371,15 +389,17 @@ export default class ProfitLoss extends Component {
alert(response.data.status)
}
} else {
alert(response.problem)
this.setState({loading: false})
this.props.onClickClose()
this.props.getReport()
alert(response.problem)
// this.props.onClickClose()
// this.props.getReport()
}
})
}
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
)
......@@ -389,33 +409,34 @@ export default class ProfitLoss extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Profit Loss.xlsx';
a.download = 'Master Budget Profit & Loss.xlsx';
a.click();
}
}
handleValidate() {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
total_actual_before: String(i[7]),
january: String(i[8]),
february: String(i[9]),
march: String(i[10]),
april: String(i[11]),
may: String(i[12]),
june: String(i[13]),
july: String(i[14]),
august: String(i[15]),
september: String(i[16]),
october: String(i[17]),
november: String(i[18]),
december: String(i[19]),
total_current_year: String(i[20]),
total_next_year: String(i[21]),
total_more_year: String(i[22])
january: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
february: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
march: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
april: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
may: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
june: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
july: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
august: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
september: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
october: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
november: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
december: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
total_current_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
total_next_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21]),
total_more_year: i[0] === 3 && i[22] === "" ? "0" : String(i[22])
})
})
let payload = {
......@@ -423,9 +444,10 @@ export default class ProfitLoss extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"profit_loss": data
"profit_loss": data,
"status": "submitted"
}
console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
......@@ -436,11 +458,14 @@ export default class ProfitLoss extends Component {
})
}
closeAlert() {
this.setState({ alert: false })
}
render() {
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 {
......@@ -464,8 +489,15 @@ export default class ProfitLoss extends Component {
total += Number(valItem)
}
})
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price" ) {
dataTable2[tableMeta.rowIndex][20] = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
return value
} else {
dataTable2[tableMeta.rowIndex][20] = total
return total
}
// console.log(total);
}
const handleNotes = (value, tableMeta) => {
......@@ -656,7 +688,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={value}
value={Number(value).toFixed(1)}
/>
}
/>
......@@ -689,7 +721,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
......@@ -706,7 +738,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -777,7 +809,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -795,7 +827,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -866,7 +898,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -884,7 +916,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -955,7 +987,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -973,7 +1005,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1044,7 +1076,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1062,7 +1094,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1133,7 +1165,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1151,7 +1183,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1222,7 +1254,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1240,7 +1272,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1311,7 +1343,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1329,7 +1361,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1400,7 +1432,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1418,7 +1450,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1489,7 +1521,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1507,7 +1539,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1578,7 +1610,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1596,7 +1628,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1667,7 +1699,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1685,7 +1717,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1754,7 +1786,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span> :
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1764,7 +1796,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleTotal(tableMeta)}
value={Number(handleTotal(tableMeta)).toFixed(1)}
/>
</span>}
</div>
......@@ -1794,7 +1826,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1812,7 +1844,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1883,7 +1915,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1901,7 +1933,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1971,25 +2003,25 @@ export default class ProfitLoss extends Component {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography>
<Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.loading && loadingComponent}
{/* {this.state.loading && loadingComponent} */}
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{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 }}>Master Budget - 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} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
......@@ -2046,26 +2078,22 @@ export default class ProfitLoss extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
......@@ -2078,7 +2106,7 @@ export default class ProfitLoss extends Component {
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div>
......@@ -2093,14 +2121,16 @@ export default class ProfitLoss extends Component {
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ loading: true }, () => {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
this.handleValidate()
}, 100);
})}
})
}}
>
<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' }}>Cancel</Typography>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
......@@ -2113,24 +2143,34 @@ export default class ProfitLoss extends Component {
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true}, () => {
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.handleValidate()
this.backToMasterBudget('draft')
}, 100);
})
}}
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 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' }}>Calculate</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.state.buttonError?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: this.backToMasterBudget('submitted')}
disabled={this.state.buttonError}
onClick={() => {
this.state.buttonError ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
}, 100);
})
: this.backToMasterBudget('submitted')
}}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......@@ -2139,7 +2179,7 @@ export default class ProfitLoss extends Component {
}}
>
<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 & Complate</Typography>
</div>
</button>
</div>
......@@ -2151,22 +2191,25 @@ export default class ProfitLoss extends Component {
<div style={{ padding: 25 }}>
<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' }}>Period : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</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({ loading: true, visibleProfitLoss: true }, () => {
......@@ -2176,14 +2219,16 @@ export default class ProfitLoss extends Component {
})}
style={{ marginRight: 20 }}
>
<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' }}>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"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......@@ -2198,26 +2243,41 @@ export default class ProfitLoss extends Component {
}, 100);
})
}}
>
<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>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss('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' }}>Calculate</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss()
this.uploadProfitLoss('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</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div>
</div>
</Paper>}
</div>
......
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