Commit d25b96d9 authored by faisalhamdi's avatar faisalhamdi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into faisal

parents dc4a2ae5 9e958691
......@@ -295,6 +295,7 @@ const create = (type = "") => {
const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body)
const checkUploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/check_import', body)
const uploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/import_monthly_report', body)
const validateSubmitReportPL = (body) => api.post('transaction/monthly_report_pl/validate_save', body)
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -520,7 +521,8 @@ const create = (type = "") => {
getHierarkiMontlyReportCF,
validateSubmitReportMR,
validateSubmitReportMRTP,
validateSubmitReportBS
validateSubmitReportBS,
validateSubmitReportPL
}
}
......
......@@ -14,6 +14,7 @@ import { Alert } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
......@@ -21,6 +22,15 @@ const LightTooltip = withStyles((theme) => ({
},
}))(Tooltip);
const LightTooltipError = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(255, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -73,11 +83,11 @@ export default class ProfitLossMR extends Component {
dataTable: [],
loading: true,
visiblePLMR: true,
// valueThreshold: 0,
minValue: 0,
maxValue: 0,
updateBy: '-',
bebeas: false
notesUpdate: '-',
bebas: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -101,8 +111,8 @@ export default class ProfitLossMR extends Component {
if (response.data.status === 'success') {
this.setState({
// valueThreshold: response.data.data[0] ? response.data.data[0].value : null,
minValue: response.data.data[0] ? response.data.data[0].min_value : -10,
maxValue: response.data.data[0] ? response.data.data[0].max_value : 10,
minValue: response.data.data[0] ? Number(response.data.data[0].min_value) : -10,
maxValue: response.data.data[0] ? Number(response.data.data[0].max_value) : 10,
}, () => {
this.getItemHierarki()
......@@ -137,7 +147,8 @@ export default class ProfitLossMR extends Component {
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notesUpdate: response.data.data.notes_update === null ? '-' : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -193,9 +204,9 @@ export default class ProfitLossMR extends Component {
item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
item.profit_loss.mtd_vs_previous_month === "" ? null : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === "" ? null : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === "" ? null : item.profit_loss.mtd_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "" : item.profit_loss.mtd_vs_rb,
item.order,
])
}
......@@ -228,9 +239,9 @@ export default class ProfitLossMR extends Component {
item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
item.profit_loss.mtd_vs_previous_month === "" ? null : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === "" ? null : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === "" ? null : item.profit_loss.mtd_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "" : item.profit_loss.mtd_vs_rb,
item.order,
])
if (item.children !== null) {
......@@ -241,8 +252,9 @@ export default class ProfitLossMR extends Component {
}
}
})
this.setState({ dataTable, loading: false })
this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true })
}
console.log(dataTable);
})
}
......@@ -328,12 +340,11 @@ export default class ProfitLossMR extends Component {
}
fileHandler = (event) => {
console.log(event);
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) {
// console.log(err);
console.log(err);
}
else {
let isi = resp.rows.slice(3)
......@@ -348,8 +359,9 @@ export default class ProfitLossMR extends Component {
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
notes: i[3] === undefined ? "" : String(i[3]).trim(),
actual: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
mtd_vs_previous_month: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
mtd_vs_mb: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
mtd_vs_rb: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
})
}
})
......@@ -381,13 +393,13 @@ export default class ProfitLossMR extends Component {
item.formula,
item.level,
item.item_report,
item.notes,
item.rolling_outlook,
item.master_budget,
item.rolling_budget,
item.actual,
item.ytd_actual,
item.actual_previous_month,
item.notes === null ? "" : item.notes === "" ? "" : item.notes,
item.rolling_outlook === null ? "" : item.rolling_outlook === "" ? "" : item.rolling_outlook,
item.master_budget === "" ? "" : item.master_budget,
item.rolling_budget === "" ? "" : item.rolling_budget,
item.actual === "" ? "" : item.actual,
item.ytd_actual === null ? "" : item.ytd_actual === "" ? "" : item.ytd_actual,
item.actual_previous_month === null ? "" : item.actual_previous_month === "" ? "" : item.actual_previous_month,
0,
0,
0,
......@@ -400,18 +412,18 @@ export default class ProfitLossMR extends Component {
// item.percent_act_vs_mb,
// item.amount_act_vs_rb,
// item.percent_act_vs_rb,
item.mtd_vs_previous_month,
item.mtd_vs_mb,
item.mtd_vs_rb,
item.mtd_vs_previous_month === "" ? "" : item.mtd_vs_previous_month,
item.mtd_vs_mb === "" ? "" : item.mtd_vs_mb,
item.mtd_vs_rb === "" ? "" : item.mtd_vs_rb === null ? '' : item.mtd_vs_rb,
item.orders,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.state.dataTable.map(item => {
if (item[23].length > 0) {
// console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
this.setState({ buttonError: true, errorPreview: true })
}
})
// console.log(this.state.buttonError)
......@@ -440,9 +452,9 @@ export default class ProfitLossMR extends Component {
percent_act_vs_mb: String(Number(i[16]).toFixed(1)),
amount_act_vs_rb: String(Number(i[17]).toFixed(1)),
percent_act_vs_rb: String(Number(i[18]).toFixed(1)),
mtd_vs_previous_month: String(Number(i[19]).toFixed(1)),
mtd_vs_mb: String(Number(i[20]).toFixed(1)),
mtd_vs_rb: String(Number(i[21]).toFixed(1)),
mtd_vs_previous_month: String(i[19]),
mtd_vs_mb: String(i[20]),
mtd_vs_rb: String(i[21]),
})
})
let body = {
......@@ -483,38 +495,121 @@ export default class ProfitLossMR extends Component {
})
}
closeAlert() {
this.setState({ alert: false })
handleValidate() {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
data.push({
"item_report_id": i[1],
"notes": i[6],
"rolling_outlook": i[7],
"master_budget": i[8],
"rolling_budget": i[9],
"actual": i[10],
"ytd_actual": i[11],
"actual_previous_month": i[12],
"amount_act_vs_previous_month": i[13],
"percent_act_vs_previous_month": i[14],
"amount_act_vs_mb": i[15],
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_previous_month": i[19],
"mtd_vs_mb": i[20],
"mtd_vs_rb": i[21]
})
})
// console.log(JSON.stringify(data));
data.map(i => {
if (i.mtd_vs_previous_month === "" && (Number(i.percent_act_vs_previous_month) < this.state.minValue || Number(i.percent_act_vs_previous_month) > this.state.maxValue)) {
console.log('msk 1');
console.log(i);
err = true
} else if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
console.log('msk 2');
err = true
} else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 3');
err = true
}
})
// if (err === true) {
// console.log('error');
// this.setState({ loading: false, buttonError: true, saveDraft: false })
// } else {
// console.log('g error');
// this.setState({ loading: false, buttonError: false, saveDraft: false })
// }
render() {
let dataTable2 = this.state.dataTable
const handleCalculate = () => {
let error = false
let messageError = ""
dataTable2.map((item, index) => {
if (item[19] == "" && Number(item[14]) <= this.state.minValue || Number(item[14]) >= this.state.maxValue) {
error = true
messageError = "MTD Explanation vs Prev. Month is Reqiured"
// console.log(JSON.stringify(data))
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": "submitted",
"months": this.props.month.month_id,
"profit_loss": data
}
console.log(JSON.stringify(payload));
api.create().validateSubmitReportPL(payload).then((response) => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
if (item[20] == "" && Number(item[16]) <= this.state.minValue || Number(item[16]) >= this.state.maxValue) {
error = true
messageError = "MTD Explanation vs MB is Reqiured"
})
}
if (item[21] == "" && Number(item[18]) <= this.state.minValue || Number(item[18]) >= this.state.maxValue) {
error = true
messageError = "MTD Explanation vs RB is Reqiured"
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
if (error === true) {
this.setState({ alert: true, messageAlert: messageError, tipeAlert: 'error', loading: false, bebas: true })
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let dataTable2 = this.state.dataTable
// const handleCalculate = () => {
// let error = false
// let messageError = ""
// dataTable2.map((item, index) => {
// if (item[19] == "" && Number(item[14]) <= this.state.minValue || Number(item[14]) >= this.state.maxValue) {
// error = true
// messageError = "MTD Explanation vs Prev. Month is Reqiured"
// }
// if (item[20] == "" && Number(item[16]) <= this.state.minValue || Number(item[16]) >= this.state.maxValue) {
// error = true
// messageError = "MTD Explanation vs MB is Reqiured"
// }
// if (item[21] == "" && Number(item[18]) <= this.state.minValue || Number(item[18]) >= this.state.maxValue) {
// error = true
// messageError = "MTD Explanation vs RB is Reqiured"
// }
// })
// if (error === true) {
// this.setState({ alert: true, messageAlert: messageError, tipeAlert: 'error', loading: false, bebas: true })
// }
// }
const handleText = (value, tableMeta, type) => {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
dataTable2[tableMeta.rowIndex][type] = value
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleChange = (value, tableMeta, type) => {
......@@ -755,7 +850,7 @@ export default class ProfitLossMR extends Component {
defaultValue={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleText(event.target.value, tableMeta, 0)
handleText(event.target.value, tableMeta, 6)
// console.log(dataTable2)
}}
/>
......@@ -1271,7 +1366,6 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1279,24 +1373,7 @@ export default class ProfitLossMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)}
// value={11}
/>
}
/>
</div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
......@@ -1343,7 +1420,6 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1351,27 +1427,11 @@ export default class ProfitLossMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleVariancePercent(tableMeta, 2, 3)).toFixed(1)}
/>
}
/>
</div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
suffix={'%'}
type="text"
placeholder=""
disabled={true}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 2, 3)).toFixed(1)}
/>
}
......@@ -1413,7 +1473,6 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1424,24 +1483,9 @@ export default class ProfitLossMR extends Component {
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(1)}
/>
}
/>
</div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
style={{ color: Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
suffix={'%'}
disabled={true}
value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(1)}
/>
}
......@@ -1498,13 +1542,13 @@ export default class ProfitLossMR extends Component {
</TableCell> */}
<div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45, backgroundColor: '#37b5e6' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"vs Prev Month"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45, backgroundColor: '#07a7d0' }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"vs MB"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45, backgroundColor: '#07a7d0' }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"vs RB"}</span>
</div>
</div>
......@@ -1523,42 +1567,48 @@ export default class ProfitLossMR extends Component {
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 1 ? null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
tableMeta.rowData[19] == "" && Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
<LightTooltip title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
disabled={false}
defaultValue={tableMeta.rowData[19]}
inputProps={{style: {
inputProps={{
style: {
color: "#5198ea",
textAlign: 'right'
}}}
textAlign: 'right',
backgroundColor: '#ffac99'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
handleText(event.target.value, tableMeta, 19)
}}
/>
</LightTooltip> :
</LightTooltipError>
:
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[19]}
inputProps={{style: {
color: "#5198ea",
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : 'black',
textAlign: 'right'
}}}
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
handleText(event.target.value, tableMeta, 19)
}}
/>
}
......@@ -1569,42 +1619,47 @@ export default class ProfitLossMR extends Component {
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 1 ? null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
tableMeta.rowData[20] == "" && Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<LightTooltip title={"MTD Explanation vs MB is Reqiured"} arrow>
tableMeta.rowData[20] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true}
disabled={false}
defaultValue={tableMeta.rowData[20]}
inputProps={{style: {
inputProps={{
style: {
color: "#5198ea",
textAlign: 'right'
}}}
textAlign: 'right',
backgroundColor: '#ffac99'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 1)
handleText(event.target.value, tableMeta, 20)
}}
/>
</LightTooltip> :
</LightTooltipError> :
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ? false : true}
disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[20]}
inputProps={{style: {
color: "#5198ea",
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : 'black',
textAlign: 'right'
}}}
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 1)
handleText(event.target.value, tableMeta, 20)
}}
/>
}
......@@ -1615,42 +1670,47 @@ export default class ProfitLossMR extends Component {
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 1 ? null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
tableMeta.rowData[21] == "" && Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ?
<LightTooltip title={"MTD Explanation vs RB is Reqiured"} arrow>
tableMeta.rowData[21] === "" && (Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs RB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ? false : true}
disabled={false}
defaultValue={tableMeta.rowData[21]}
inputProps={{style: {
inputProps={{
style: {
color: "#5198ea",
textAlign: 'right'
}}}
textAlign: 'right',
backgroundColor: '#ffac99'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
handleText(event.target.value, tableMeta, 21)
}}
/>
</LightTooltip> :
</LightTooltipError> :
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[18]) <= this.state.minValue || Number(tableMeta.rowData[18]) >= this.state.maxValue ? false : true}
disabled={Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? false : true}
defaultValue={tableMeta.rowData[21]}
inputProps={{style: {
color: "#5198ea",
inputProps={{
style: {
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : 'black',
textAlign: 'right'
}}}
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
handleText(event.target.value, tableMeta, 21)
}}
/>
}
......@@ -1701,11 +1761,6 @@ export default class ProfitLossMR extends Component {
<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>
</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%' }}>
{this.state.visiblePLMR ?
<Paper style={{ paddingTop: 10 }}>
......@@ -1796,7 +1851,7 @@ export default class ProfitLossMR extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
{/* {!this.state.loading && ( */}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -1804,10 +1859,11 @@ export default class ProfitLossMR extends Component {
options={options}
/>
</MuiThemeProvider>
)}
{/* )} */}
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(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') ? */}
......@@ -1849,10 +1905,7 @@ export default class ProfitLossMR extends Component {
onClick={() => {
this.setState({ loading: true, bebas: false }, () => {
setTimeout(() => {
handleCalculate()
this.setState({ loading: false })
// this.handleValidate()
this.handleValidate()
}, 100);
})
}}
......@@ -1866,7 +1919,7 @@ export default class ProfitLossMR extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.bebas ? 'default' : this.state.saveDraft !== true ? 'pointer' : 'default',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
......@@ -1874,7 +1927,6 @@ export default class ProfitLossMR extends Component {
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.bebas ? null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
......@@ -1887,9 +1939,8 @@ export default class ProfitLossMR extends Component {
</button>
<button
type="button"
// disabled={this.state.buttonError}
disabled={this.state.buttonError}
onClick={() =>
this.state.bebas ? null :
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
......@@ -1899,7 +1950,7 @@ export default class ProfitLossMR extends Component {
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : this.state.bebas ? 'default' : 'pointer',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
......@@ -1926,7 +1977,7 @@ export default class ProfitLossMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
{/* {!this.state.loading && ( */}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -1934,15 +1985,15 @@ export default class ProfitLossMR extends Component {
options={options}
/>
</MuiThemeProvider>
)}
{/* )} */}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => {
setTimeout(() => {
this.props.onClickClose()
this.getItemHierarki()
}, 100);
})}
style={{
......@@ -1971,8 +2022,8 @@ export default class ProfitLossMR extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
// this.setState({ loading: false })
this.handleValidate()
}, 100);
})
}}
......@@ -2006,7 +2057,7 @@ export default class ProfitLossMR extends Component {
</button>
<button
type="button"
// disabled={this.state.buttonError}
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
......
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