Commit d65f080b authored by EKSAD's avatar EKSAD

apdet issue

parent 5a4aad16
...@@ -44,7 +44,8 @@ export default class ProfitLoss extends Component { ...@@ -44,7 +44,8 @@ export default class ProfitLoss extends Component {
disabledSave: true, disabledSave: true,
editable: false, editable: false,
buttonError: false, buttonError: false,
judulColumn: null judulColumn: null,
updateBy: '-'
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -52,9 +53,29 @@ export default class ProfitLoss extends Component { ...@@ -52,9 +53,29 @@ export default class ProfitLoss extends Component {
componentDidMount() { componentDidMount() {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate()
console.log(this.props); 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() { getItemHierarki() {
this.setState({ loading: true, judulColumn: null }) this.setState({ loading: true, judulColumn: null })
let payload = { let payload = {
...@@ -181,22 +202,22 @@ export default class ProfitLoss extends Component { ...@@ -181,22 +202,22 @@ export default class ProfitLoss extends Component {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
notes: i[6] == null || i[6] == "" ? "" : String(i[6]), notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
total_actual_before: String(i[7]), total_actual_before: String(Number(i[7]).toFixed(1)),
january: String(i[8]), january: String(Number(i[8]).toFixed(1)),
february: String(i[9]), february: String(Number(i[9]).toFixed(1)),
march: String(i[10]), march: String(Number(i[10]).toFixed(1)),
april: String(i[11]), april: String(Number(i[11]).toFixed(1)),
may: String(i[12]), may: String(Number(i[12]).toFixed(1)),
june: String(i[13]), june: String(Number(i[13]).toFixed(1)),
july: String(i[14]), july: String(Number(i[14]).toFixed(1)),
august: String(i[15]), august: String(Number(i[15]).toFixed(1)),
september: String(i[16]), september: String(Number(i[16]).toFixed(1)),
october: String(i[17]), october: String(Number(i[17]).toFixed(1)),
november: String(i[18]), november: String(Number(i[18]).toFixed(1)),
december: String(i[19]), december: String(Number(i[19]).toFixed(1)),
total_current_year: String(i[20]), total_current_year: String(Number(i[20]).toFixed(1)),
total_next_year: String(i[21]), total_next_year: String(Number(i[21]).toFixed(1)),
total_more_year: String(i[22]) total_more_year: String(Number(i[22]).toFixed(1))
}) })
}) })
let payload = { let payload = {
...@@ -207,7 +228,7 @@ export default class ProfitLoss extends Component { ...@@ -207,7 +228,7 @@ export default class ProfitLoss extends Component {
"status": type, "status": type,
"profit_loss": data "profit_loss": data
} }
console.log(data); // console.log(data);
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -318,36 +339,35 @@ export default class ProfitLoss extends Component { ...@@ -318,36 +339,35 @@ export default class ProfitLoss extends Component {
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true })
} }
}) })
// console.log(dataTable) // console.log(this.state.buttonError)
}) })
} }
} }
}) })
} }
uploadProfitLoss() { uploadProfitLoss(type) {
// console.log('tes');
let data = [] let data = []
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
notes: String(i[6]), notes: String(i[6]),
total_actual_before: String(i[7]), total_actual_before: String(Number(i[7]).toFixed(1)),
january: String(i[8]), january: String(Number(i[8]).toFixed(1)),
february: String(i[9]), february: String(Number(i[9]).toFixed(1)),
march: String(i[10]), march: String(Number(i[10]).toFixed(1)),
april: String(i[11]), april: String(Number(i[11]).toFixed(1)),
may: String(i[12]), may: String(Number(i[12]).toFixed(1)),
june: String(i[13]), june: String(Number(i[13]).toFixed(1)),
july: String(i[14]), july: String(Number(i[14]).toFixed(1)),
august: String(i[15]), august: String(Number(i[15]).toFixed(1)),
september: String(i[16]), september: String(Number(i[16]).toFixed(1)),
october: String(i[17]), october: String(Number(i[17]).toFixed(1)),
november: String(i[18]), november: String(Number(i[18]).toFixed(1)),
december: String(i[19]), december: String(Number(i[19]).toFixed(1)),
total_current_year: String(i[20]), total_current_year: String(Number(i[20]).toFixed(1)),
total_next_year: String(i[21]), total_next_year: String(Number(i[21]).toFixed(1)),
total_more_year: String(i[22]) total_more_year: String(Number(i[22]).toFixed(1)),
}) })
}) })
let body = { let body = {
...@@ -355,7 +375,8 @@ export default class ProfitLoss extends Component { ...@@ -355,7 +375,8 @@ export default class ProfitLoss extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
profit_loss: data profit_loss: data,
status: type
} }
console.log(data); console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
...@@ -368,10 +389,10 @@ export default class ProfitLoss extends Component { ...@@ -368,10 +389,10 @@ export default class ProfitLoss extends Component {
alert(response.data.status) alert(response.data.status)
} }
} else { } else {
alert(response.problem)
this.setState({loading: false}) this.setState({loading: false})
this.props.onClickClose() alert(response.problem)
this.props.getReport() // this.props.onClickClose()
// this.props.getReport()
} }
}) })
} }
...@@ -388,7 +409,7 @@ export default class ProfitLoss extends Component { ...@@ -388,7 +409,7 @@ export default class ProfitLoss extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Balance Sheet.xlsx'; a.download = 'Master Budget Profit & Loss.xlsx';
a.click(); a.click();
} }
} }
...@@ -401,21 +422,21 @@ export default class ProfitLoss extends Component { ...@@ -401,21 +422,21 @@ export default class ProfitLoss extends Component {
item_report_id: i[1], item_report_id: i[1],
notes: i[6] == null || i[6] == "" ? "" : String(i[6]), notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
total_actual_before: String(i[7]), total_actual_before: String(i[7]),
january: String(i[8]), january: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
february: String(i[9]), february: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
march: String(i[10]), march: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
april: String(i[11]), april: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
may: String(i[12]), may: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
june: String(i[13]), june: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
july: String(i[14]), july: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
august: String(i[15]), august: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
september: String(i[16]), september: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
october: String(i[17]), october: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
november: String(i[18]), november: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
december: String(i[19]), december: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
total_current_year: String(i[20]), total_current_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
total_next_year: String(i[21]), total_next_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21]),
total_more_year: String(i[22]) total_more_year: i[0] === 3 && i[22] === "" ? "0" : String(i[22])
}) })
}) })
let payload = { let payload = {
...@@ -667,7 +688,7 @@ export default class ProfitLoss extends Component { ...@@ -667,7 +688,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={value} value={Number(value).toFixed(1)}
/> />
} }
/> />
...@@ -697,11 +718,10 @@ export default class ProfitLoss extends Component { ...@@ -697,11 +718,10 @@ export default class ProfitLoss extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
decimalSeparator={"."}
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) console.log(dataTable2)
...@@ -718,7 +738,7 @@ export default class ProfitLoss extends Component { ...@@ -718,7 +738,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -789,7 +809,7 @@ export default class ProfitLoss extends Component { ...@@ -789,7 +809,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -807,7 +827,7 @@ export default class ProfitLoss extends Component { ...@@ -807,7 +827,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -878,7 +898,7 @@ export default class ProfitLoss extends Component { ...@@ -878,7 +898,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -896,7 +916,7 @@ export default class ProfitLoss extends Component { ...@@ -896,7 +916,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -967,7 +987,7 @@ export default class ProfitLoss extends Component { ...@@ -967,7 +987,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -985,7 +1005,7 @@ export default class ProfitLoss extends Component { ...@@ -985,7 +1005,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1056,7 +1076,7 @@ export default class ProfitLoss extends Component { ...@@ -1056,7 +1076,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1074,7 +1094,7 @@ export default class ProfitLoss extends Component { ...@@ -1074,7 +1094,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1145,7 +1165,7 @@ export default class ProfitLoss extends Component { ...@@ -1145,7 +1165,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1163,7 +1183,7 @@ export default class ProfitLoss extends Component { ...@@ -1163,7 +1183,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1234,7 +1254,7 @@ export default class ProfitLoss extends Component { ...@@ -1234,7 +1254,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1252,7 +1272,7 @@ export default class ProfitLoss extends Component { ...@@ -1252,7 +1272,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1323,7 +1343,7 @@ export default class ProfitLoss extends Component { ...@@ -1323,7 +1343,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1341,7 +1361,7 @@ export default class ProfitLoss extends Component { ...@@ -1341,7 +1361,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1412,7 +1432,7 @@ export default class ProfitLoss extends Component { ...@@ -1412,7 +1432,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1430,7 +1450,7 @@ export default class ProfitLoss extends Component { ...@@ -1430,7 +1450,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1501,7 +1521,7 @@ export default class ProfitLoss extends Component { ...@@ -1501,7 +1521,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1519,7 +1539,7 @@ export default class ProfitLoss extends Component { ...@@ -1519,7 +1539,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1590,7 +1610,7 @@ export default class ProfitLoss extends Component { ...@@ -1590,7 +1610,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1608,7 +1628,7 @@ export default class ProfitLoss extends Component { ...@@ -1608,7 +1628,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1679,7 +1699,7 @@ export default class ProfitLoss extends Component { ...@@ -1679,7 +1699,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1697,7 +1717,7 @@ export default class ProfitLoss extends Component { ...@@ -1697,7 +1717,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1766,7 +1786,7 @@ export default class ProfitLoss extends Component { ...@@ -1766,7 +1786,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> : </span> :
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
...@@ -1776,7 +1796,7 @@ export default class ProfitLoss extends Component { ...@@ -1776,7 +1796,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleTotal(tableMeta)} value={Number(handleTotal(tableMeta)).toFixed(1)}
/> />
</span>} </span>}
</div> </div>
...@@ -1806,7 +1826,7 @@ export default class ProfitLoss extends Component { ...@@ -1806,7 +1826,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1824,7 +1844,7 @@ export default class ProfitLoss extends Component { ...@@ -1824,7 +1844,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -1895,7 +1915,7 @@ export default class ProfitLoss extends Component { ...@@ -1895,7 +1915,7 @@ export default class ProfitLoss extends Component {
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' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1913,7 +1933,7 @@ export default class ProfitLoss extends Component { ...@@ -1913,7 +1933,7 @@ export default class ProfitLoss extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -2067,22 +2087,17 @@ export default class ProfitLoss extends Component { ...@@ -2067,22 +2087,17 @@ export default class ProfitLoss extends Component {
/> />
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</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">
<button <button
type="button" type="button"
onClick={() => this.state.editable === true ? onClick={() => this.setState({ loading: true }, () => {
this.setState({ loading: true }, () => { setTimeout(() => {
setTimeout(() => { this.props.onClickClose()
this.backToMasterBudget('draft') }, 100);
}, 100); })}
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
...@@ -2091,7 +2106,7 @@ export default class ProfitLoss extends Component { ...@@ -2091,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' }}> <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> </div>
</button> </button>
</div> </div>
...@@ -2106,14 +2121,16 @@ export default class ProfitLoss extends Component { ...@@ -2106,14 +2121,16 @@ export default class ProfitLoss extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.setState({ loading: true }, () => { onClick={() => {
setTimeout(() => { this.setState({ loading: true }, () => {
this.props.onClickClose() setTimeout(() => {
}, 100); this.handleValidate()
})} }, 100);
})
}}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <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> </div>
</button> </button>
<button <button
...@@ -2126,16 +2143,20 @@ export default class ProfitLoss extends Component { ...@@ -2126,16 +2143,20 @@ export default class ProfitLoss extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => this.state.editable === true ?
this.setState({ loading: true}, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.backToMasterBudget('draft')
}, 100); }, 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' }}> <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> </div>
</button> </button>
<button <button
...@@ -2158,7 +2179,7 @@ export default class ProfitLoss extends Component { ...@@ -2158,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' }}> <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> </div>
</button> </button>
</div> </div>
...@@ -2186,56 +2207,75 @@ export default class ProfitLoss extends Component { ...@@ -2186,56 +2207,75 @@ export default class ProfitLoss extends Component {
</div> </div>
)} )}
</div> </div>
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<button <div className="grid grid-2x" style={{ marginTop: 20 }}>
type="button" <div className="col-1">
onClick={() => this.setState({ loading: true, visibleProfitLoss: true }, () => { <button
setTimeout(() => { type="button"
this.getItemHierarki() onClick={() => this.setState({ loading: true, visibleProfitLoss: true }, () => {
}, 100);
})}
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>
</button>
<button
className="button"
type="button"
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false }) this.getItemHierarki()
}, 100); }, 100);
}) })}
}} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#019ce5', 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' }}>Cancel</Typography>
</div> </div>
</button> </button>
<button </div>
type="button" <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
// disabled={this.state.buttonError} <button
onClick={() => this.setState({ loading: true }, () => { className="button"
setTimeout(() => { type="button"
this.uploadProfitLoss() // disabled={this.state.buttonError}
}, 100); style={{
})} backgroundColor: 'transparent',
> cursor: this.state.buttonError === true ? 'default' : 'pointer',
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> borderColor: 'transparent',
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> outline: 'none',
</div> marginRight: 20
</button> }}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
}, 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' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
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 & Complete</Typography>
</div>
</button>
</div>
</div> </div>
</div> </div>
</Paper>} </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