Commit 0dd4add5 authored by faisalhamdi's avatar faisalhamdi

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

parents 27a5c44f 1b1a7da4
...@@ -283,6 +283,7 @@ const create = (type = "") => { ...@@ -283,6 +283,7 @@ const create = (type = "") => {
const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body) const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body)
const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body) const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body) const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report/validate_save', body)
// MonthlyPL // MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body) const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
...@@ -508,7 +509,8 @@ const create = (type = "") => { ...@@ -508,7 +509,8 @@ const create = (type = "") => {
uploadMonthlyReportFAM, uploadMonthlyReportFAM,
uploadMonthlyReportTP, uploadMonthlyReportTP,
uploadMonthlyReportOI, uploadMonthlyReportOI,
getHierarkiMontlyReportCF getHierarkiMontlyReportCF,
validateSubmitReportMR
} }
} }
......
...@@ -439,6 +439,63 @@ export default class BalanceSheetMR extends Component { ...@@ -439,6 +439,63 @@ export default class BalanceSheetMR extends Component {
}) })
} }
handleValidate() {
let data = []
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"rolling_outlook": i[6],
"master_budget": i[7],
"rolling_budget": i[8],
"actual": i[9],
"actual_previous_month": i[10],
"amount_act_vs_previous_month": i[11],
"percent_act_vs_previous_month": i[12],
"amount_act_vs_mb": i[13],
"percent_act_vs_mb": i[14],
"amount_act_vs_rb": i[15],
"percent_act_vs_rb": i[16],
"mtd_vs_previous_month": i[17],
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
})
})
// 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,
"balance_sheet": data
}
api.create().validateSubmitReportMR(payload).then((response) => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result) {
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);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => { const handleChange = (value, tableMeta, type) => {
...@@ -1811,8 +1868,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1811,8 +1868,7 @@ export default class BalanceSheetMR extends Component {
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.handleValidate()
// this.handleValidate()
}, 100); }, 100);
}) })
}} }}
...@@ -1846,7 +1902,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1846,7 +1902,7 @@ export default class BalanceSheetMR extends Component {
</button> </button>
<button <button
type="button" type="button"
// disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
...@@ -1928,8 +1984,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1928,8 +1984,7 @@ export default class BalanceSheetMR extends Component {
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.handleValidate()
// this.handleValidate()
}, 100); }, 100);
}) })
}} }}
...@@ -1963,7 +2018,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1963,7 +2018,7 @@ export default class BalanceSheetMR extends Component {
</button> </button>
<button <button
type="button" type="button"
// disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
......
...@@ -274,8 +274,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -274,8 +274,8 @@ export default class ListOfCreditFacilities extends Component {
// console.log(dataTable); // console.log(dataTable);
if (dataTable.length == 0) { if (dataTable.length == 0) {
dataTable.push( dataTable.push(
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "" ], [3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ],
[9, "", "", "", "", "", "Grand Total", null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "" ], [9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
) )
} }
...@@ -695,6 +695,19 @@ export default class ListOfCreditFacilities extends Component { ...@@ -695,6 +695,19 @@ export default class ListOfCreditFacilities extends Component {
const handleFormulaHardcode = (value, tableMeta, column) => { const handleFormulaHardcode = (value, tableMeta, column) => {
let valuez = 0 let valuez = 0
if (tableMeta.rowData[0] == 8) {
dataTable2.map((item,index) => {
if (item[6].value.includes(String(tableMeta.rowData[6].value).substr(6,tableMeta.rowData[6].length)) && item[0] != 8) {
valuez += Number(item[column])
}
})
} else if (tableMeta.rowData[0] == 9) {
dataTable2.map((item,index) => {
if (item[0] == 8) {
valuez += Number(item[column])
}
})
} else {
if (column == 21) { if (column == 21) {
valuez = Number(tableMeta.rowData[14]) + Number(tableMeta.rowData[16]) + Number(tableMeta.rowData[19]) valuez = Number(tableMeta.rowData[14]) + Number(tableMeta.rowData[16]) + Number(tableMeta.rowData[19])
} else if (column == 22) { } else if (column == 22) {
...@@ -704,6 +717,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -704,6 +717,8 @@ export default class ListOfCreditFacilities extends Component {
} else if (column == 24) { } else if (column == 24) {
valuez = Number(tableMeta.rowData[13]) - Number(tableMeta.rowData[22]) valuez = Number(tableMeta.rowData[13]) - Number(tableMeta.rowData[22])
} }
}
dataTable2[tableMeta.rowIndex][column] = valuez dataTable2[tableMeta.rowIndex][column] = valuez
return valuez return valuez
} }
...@@ -711,9 +726,17 @@ export default class ListOfCreditFacilities extends Component { ...@@ -711,9 +726,17 @@ export default class ListOfCreditFacilities extends Component {
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
// // console.log(dataTable2) // // console.log(dataTable2)
let newData = [] let newData = []
let indexxx = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
indexxx = index
if (item[6] == "Grand Total") {
item[46] = 999999
} else {
item[46] = indexxx
}
newData.push(item) newData.push(item)
if (index == rowIndex) { if (index == rowIndex) {
indexxx = index + 1
newData.push([ newData.push([
3, 3,
"", "",
...@@ -760,16 +783,17 @@ export default class ListOfCreditFacilities extends Component { ...@@ -760,16 +783,17 @@ export default class ListOfCreditFacilities extends Component {
"", "",
"", "",
"", "",
"" ], "notez",
indexxx],
) )
} }
}) })
dataTable2 = newData.sort((a,b) => a[6].value.localeCompare(b[6].value)) dataTable2 = newData.sort((a,b) => a[46] - b[46])
this.setState({ dataTable: dataTable2 }, () => { this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false })
// // console.log(dataTable2) console.log(dataTable2)
}, 500) }, 500)
}) })
} }
...@@ -788,17 +812,164 @@ export default class ListOfCreditFacilities extends Component { ...@@ -788,17 +812,164 @@ export default class ListOfCreditFacilities extends Component {
const handleCalculate = () => { const handleCalculate = () => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
let bankPrev = ""
let idPrev = 0
let newData = []
let indexxx = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
let indexId = dataTampungBank.findIndex((val) => val == item[6].value ) indexxx = index
if (indexId == -1) { if (item[6] == "Grand Total") {
dataTampungBank.push(item[6].value) item[46] = 999999
} else {
item[46] = indexxx
}
if (bankPrev != "") {
if (item[6].value !== bankPrev) {
if (item[6].value == 'Grand Total') {
// if (dataTable2.length > 2) {
// newData.push(item)
// } else {
if (String(dataTable2[index - 1][6].value).includes('Total ')) {
newData.push(item)
} else {
if (String(dataTable2[index][6].value).includes('Total ')) {
newData.push(item)
} else {
item[46] = index + 1
let nameTotal = String(dataTable2[index - 1][6].value).split("-")
newData.push([
8,
"",
"",
"",
"",
"",
{value: 'Total ' + nameTotal[nameTotal.length - 1]},
null,
"",
this.state.currentDate,
"",
"0",
"",
"0",
"",
"0",
"",
"0",
"",
"",
"0",
"0",
"0",
"0",
"0",
"",
"0",
"",
"0",
"",
"0",
"",
"0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"notez",
index],
item,
)
}
} }
} else {
if (String(dataTable2[index - 1][6].value).includes('Total ')) {
newData.push(item)
} else {
if (String(dataTable2[index][6].value).includes('Total ')) {
newData.push(item)
} else {
item[46] = index + 1
let nameTotal = String(dataTable2[index - 1][6].value).split("-")
newData.push([
8,
"",
"",
"",
"",
"",
{value: 'Total ' + nameTotal[nameTotal.length - 1]},
null,
"",
this.state.currentDate,
"",
"0",
"",
"0",
"",
"0",
"",
"0",
"",
"",
"0",
"0",
"0",
"0",
"0",
"",
"0",
"",
"0",
"",
"0",
"",
"0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"notez",
index],
item,
)
}
}
}
}
else {
newData.push(item)
}
} else {
bankPrev = item[6].value
idPrev = item[0]
newData.push(item)
}
}) })
// console.log(dataTampungBank) // console.log(newData)
setTimeout(() => { setTimeout(() => {
console.log(dataTampungBank) // console.log(newData)
this.setState({ loading: false }) // console.log(dataTampungBank)
this.setState({ loading: false, dataTable: newData })
}, 100); }, 100);
}) })
} }
...@@ -913,7 +1084,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -913,7 +1084,7 @@ export default class ListOfCreditFacilities extends Component {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9 || tableMeta.rowData[0] === 4 ?
val : val.value :
<Autocomplete <Autocomplete
{...this.state.bankNameList} {...this.state.bankNameList}
id="bankNameList" id="bankNameList"
...@@ -980,6 +1151,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -980,6 +1151,8 @@ export default class ListOfCreditFacilities extends Component {
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{ tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
...@@ -996,6 +1169,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -996,6 +1169,8 @@ export default class ListOfCreditFacilities extends Component {
}} }}
/> />
</ThemeProvider> </ThemeProvider>
}
</div> </div>
) )
} }
...@@ -1155,6 +1330,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1155,6 +1330,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1182,6 +1375,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1182,6 +1375,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1244,6 +1455,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1244,6 +1455,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1270,6 +1499,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1270,6 +1499,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1331,6 +1578,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1331,6 +1578,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1357,6 +1622,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1357,6 +1622,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1421,6 +1704,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1421,6 +1704,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
...@@ -1446,6 +1747,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1446,6 +1747,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[20], tableMeta, 20)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1530,6 +1849,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1530,6 +1849,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1553,6 +1890,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1553,6 +1890,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1608,6 +1963,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1608,6 +1963,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[23], tableMeta, 23)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1631,6 +2004,24 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1631,6 +2004,24 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormulaHardcode(tableMeta.rowData[24], tableMeta, 24)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1688,7 +2079,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1688,7 +2079,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-2x content-center"> <div className="grid grid-2x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -1713,7 +2104,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1713,7 +2104,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1768,7 +2159,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1768,7 +2159,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-2x content-center"> <div className="grid grid-2x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -1793,7 +2184,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1793,7 +2184,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1848,7 +2239,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1848,7 +2239,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-2x content-center"> <div className="grid grid-2x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -1873,7 +2264,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1873,7 +2264,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1928,7 +2319,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1928,7 +2319,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-2x content-center"> <div className="grid grid-2x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -1953,7 +2344,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1953,7 +2344,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -2011,7 +2402,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2011,7 +2402,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2036,7 +2427,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2036,7 +2427,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2061,7 +2452,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2061,7 +2452,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -2122,7 +2513,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2122,7 +2513,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2147,7 +2538,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2147,7 +2538,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2172,7 +2563,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2172,7 +2563,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -2233,7 +2624,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2233,7 +2624,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2258,7 +2649,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2258,7 +2649,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2283,7 +2674,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2283,7 +2674,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -2344,7 +2735,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2344,7 +2735,7 @@ export default class ListOfCreditFacilities extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2369,7 +2760,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2369,7 +2760,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -2394,7 +2785,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2394,7 +2785,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -2435,6 +2826,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2435,6 +2826,8 @@ export default class ListOfCreditFacilities extends Component {
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
...@@ -2451,6 +2844,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2451,6 +2844,7 @@ export default class ListOfCreditFacilities extends Component {
}} }}
/> />
</ThemeProvider> </ThemeProvider>
}
</div> </div>
) )
} }
......
...@@ -74,6 +74,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -74,6 +74,7 @@ export default class OperatingIndicatorMR extends Component {
// this.getItemHierarki() // this.getItemHierarki()
this.getSettingControl() this.getSettingControl()
this.getLatestUpdate() this.getLatestUpdate()
console.log(this.props.permission.create);
} }
getSettingControl() { getSettingControl() {
...@@ -852,7 +853,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -852,7 +853,7 @@ export default class OperatingIndicatorMR 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=""
disabled={false} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(tableMeta.rowData[10]).toFixed(1)} value={Number(tableMeta.rowData[10]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1119,7 +1120,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1119,7 +1120,7 @@ export default class OperatingIndicatorMR 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=""
disabled={false} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(tableMeta.rowData[15]).toFixed(1)} value={Number(tableMeta.rowData[15]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1175,7 +1176,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1175,7 +1176,7 @@ export default class OperatingIndicatorMR 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=""
disabled={false} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(tableMeta.rowData[16]).toFixed(1)} value={Number(tableMeta.rowData[16]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1573,7 +1574,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1573,7 +1574,7 @@ export default class OperatingIndicatorMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => { onUpload={() => {
this.state.judul === "MONTHLY REPORT - MONTHLY REPORT" ? String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
this.checkUpload() : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}} }}
......
...@@ -51,6 +51,21 @@ const styleNotesEmpty = { ...@@ -51,6 +51,21 @@ const styleNotesEmpty = {
zIndex: 99, zIndex: 99,
left: 0 left: 0
} }
const StyledButton = withStyles({
root: {
background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
borderRadius: 3,
border: 0,
color: 'white',
height: 48,
padding: '0 30px',
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
},
label: {
textTransform: 'capitalize',
},
})(Input);
export default class ProfitLossMR extends Component { export default class ProfitLossMR extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -170,16 +185,16 @@ export default class ProfitLossMR extends Component { ...@@ -170,16 +185,16 @@ export default class ProfitLossMR extends Component {
item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget, item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual, item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual, item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month, item.profit_loss.actual_previous_month === null ? "5.0" : item.profit_loss.actual_previous_month === "" ? "5.0" : item.profit_loss.actual_previous_month,
item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month, item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month, item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb, item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
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.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.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.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 ? "0.0" : item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month, item.profit_loss.mtd_vs_previous_month === "" ? null : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "0.0" : item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb, item.profit_loss.mtd_vs_mb === "" ? null : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb, item.profit_loss.mtd_vs_rb === "" ? null : item.profit_loss.mtd_vs_rb,
item.order, item.order,
]) ])
} }
...@@ -205,16 +220,16 @@ export default class ProfitLossMR extends Component { ...@@ -205,16 +220,16 @@ export default class ProfitLossMR extends Component {
item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget, item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual, item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual, item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month, item.profit_loss.actual_previous_month === null ? "5.0" : item.profit_loss.actual_previous_month === "" ? "5.0" : item.profit_loss.actual_previous_month,
item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month, item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month, item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb, item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
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.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.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.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 ? "0.0" : item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month, item.profit_loss.mtd_vs_previous_month === "" ? null : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "0.0" : item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb, item.profit_loss.mtd_vs_mb === "" ? null : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb, item.profit_loss.mtd_vs_rb === "" ? null : item.profit_loss.mtd_vs_rb,
item.order, item.order,
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -473,8 +488,8 @@ export default class ProfitLossMR extends Component { ...@@ -473,8 +488,8 @@ export default class ProfitLossMR extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleNotes = (value, tableMeta) => { const handleText = (value, tableMeta, type) => {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
// console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
} }
const handleChange = (value, tableMeta, type) => { const handleChange = (value, tableMeta, type) => {
...@@ -705,14 +720,17 @@ export default class ProfitLossMR extends Component { ...@@ -705,14 +720,17 @@ export default class ProfitLossMR extends Component {
control={ control={
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
inputProps={{style: {
color: "#5198ea"
}}}
placeholder="" placeholder=""
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} // disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleNotes(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 0)
// console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
...@@ -1241,6 +1259,7 @@ export default class ProfitLossMR extends Component { ...@@ -1241,6 +1259,7 @@ export default class ProfitLossMR extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)} value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)}
// value={11}
/> />
} }
/> />
...@@ -1258,6 +1277,7 @@ export default class ProfitLossMR extends Component { ...@@ -1258,6 +1277,7 @@ export default class ProfitLossMR extends Component {
suffix={'%'} suffix={'%'}
disabled={true} disabled={true}
value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)} value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)}
// value={11}
/> />
} }
/> />
...@@ -1477,167 +1497,86 @@ export default class ProfitLossMR extends Component { ...@@ -1477,167 +1497,86 @@ export default class ProfitLossMR extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{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 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={tableMeta.rowData[19]} // value={value}
control={ control={
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
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=""
disabled={false} disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
value={Number(tableMeta.rowData[19]).toFixed(1)} defaultValue={tableMeta.rowData[19]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 0)
}} }}
/> />
} }
/> />}
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/>
</span> :
<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}
value={Number(tableMeta.rowData[19]).toFixed(1)}
/>
}
/>
</div> </div>
}
</div> </div>
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{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 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={tableMeta.rowData[20]} // value={value}
control={ control={
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
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=""
disabled={false} disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
value={Number(tableMeta.rowData[20]).toFixed(1)} defaultValue={tableMeta.rowData[20]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 1)
}} }}
/> />
} }
/> />}
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 1)).toFixed(1)}
/>
</span> :
<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}
value={Number(tableMeta.rowData[20]).toFixed(1)}
/>
}
/>
</div> </div>
}
</div> </div>
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{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 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={tableMeta.rowData[21]} // value={value}
control={ control={
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
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=""
disabled={false} disabled={Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ? false : true}
value={Number(tableMeta.rowData[21]).toFixed(1)} defaultValue={tableMeta.rowData[21]}
inputProps={{style: {
color: "#5198ea",
textAlign: 'right'
}}}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleText(event.target.value, tableMeta, 0)
}} }}
/> />
} }
/> />}
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
<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}
value={Number(tableMeta.rowData[21]).toFixed(1)}
/>
}
/>
</div> </div>
}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -62,7 +62,7 @@ export default class OperatingIndicator extends Component { ...@@ -62,7 +62,7 @@ export default class OperatingIndicator extends Component {
menu: "operating indicator" menu: "operating indicator"
} }
api.create().getPermission(payload).then(response => { api.create().getPermission(payload).then(response => {
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -321,7 +321,7 @@ export default class OperatingIndicator extends Component { ...@@ -321,7 +321,7 @@ export default class OperatingIndicator extends Component {
visibleDetailRolling: false, visibleDetailRolling: false,
months: id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : 0 months: id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : 0
}, () => console.log(this.state.dataDetail)) })
} else { } else {
this.setState({ this.setState({
......
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