Commit fde3083b authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

Deni dev(pc)

See merge request !375
parents 90c3e505 0db200dd
...@@ -198,6 +198,7 @@ const create = (type = "") => { ...@@ -198,6 +198,7 @@ const create = (type = "") => {
const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body) const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body)
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body) const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
const getMonthTransaction = () => api.get('transaction/get_default_month') const getMonthTransaction = () => api.get('transaction/get_default_month')
const countingFormula = (body) => api.post('transaction/counting_formula', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body) const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
...@@ -350,7 +351,8 @@ const create = (type = "") => { ...@@ -350,7 +351,8 @@ const create = (type = "") => {
validateSubmitReport, validateSubmitReport,
checkUploadOperatingInd, checkUploadOperatingInd,
uploadOperatingInd, uploadOperatingInd,
getLastestUpdateMB getLastestUpdateMB,
countingFormula
} }
} }
......
...@@ -208,11 +208,12 @@ export default class BudgetTahunan extends Component { ...@@ -208,11 +208,12 @@ export default class BudgetTahunan extends Component {
}) })
} }
clickDetail(item, id, revision) { clickDetail(item, id, revision, status) {
console.log(item); console.log(item);
this.setState({ this.setState({
report_id: id, report_id: id,
revisionTable: revision, revisionTable: revision,
status: status
}, () => { }, () => {
if (item === 'Balance Sheet') { if (item === 'Balance Sheet') {
this.setState({ this.setState({
...@@ -415,7 +416,7 @@ export default class BudgetTahunan extends Component { ...@@ -415,7 +416,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2]) : null tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) : null
} }
> >
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
...@@ -653,6 +654,7 @@ export default class BudgetTahunan extends Component { ...@@ -653,6 +654,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)} saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
getReport={this.getReport.bind(this)} getReport={this.getReport.bind(this)}
status={this.state.status}
/> />
)} )}
......
...@@ -115,7 +115,8 @@ export default class BalanceSheet extends Component { ...@@ -115,7 +115,8 @@ export default class BalanceSheet extends Component {
item.balance_sheet.december, item.balance_sheet.december,
item.balance_sheet.total_current_year, item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year item.balance_sheet.total_more_year,
item.order
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -149,7 +150,8 @@ export default class BalanceSheet extends Component { ...@@ -149,7 +150,8 @@ export default class BalanceSheet extends Component {
item.balance_sheet.december, item.balance_sheet.december,
item.balance_sheet.total_current_year, item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year item.balance_sheet.total_more_year,
item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -323,12 +325,13 @@ export default class BalanceSheet extends Component { ...@@ -323,12 +325,13 @@ export default class BalanceSheet extends Component {
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.order,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[22].length > 0) { if (item[23].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true })
} }
...@@ -491,7 +494,7 @@ export default class BalanceSheet extends Component { ...@@ -491,7 +494,7 @@ export default class BalanceSheet extends Component {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[1] == item) let index = dataTable2.findIndex((val) => val[22] == item)
if (index > 0) { if (index > 0) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex]) arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else { } else {
...@@ -569,8 +572,8 @@ export default class BalanceSheet extends Component { ...@@ -569,8 +572,8 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[22] ? {tableMeta.rowData[23] ?
tableMeta.rowData[22].length > 0 ? tableMeta.rowData[23].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow> <LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
...@@ -1936,6 +1939,12 @@ export default class BalanceSheet extends Component { ...@@ -1936,6 +1939,12 @@ export default class BalanceSheet extends Component {
} }
} }
}, },
{
name: "",
options: {
display: false
}
},
{ {
name: "", name: "",
options: { options: {
......
...@@ -116,7 +116,8 @@ export default class ProfitLoss extends Component { ...@@ -116,7 +116,8 @@ export default class ProfitLoss extends Component {
item.profit_loss.december, item.profit_loss.december,
item.profit_loss.total_current_year, item.profit_loss.total_current_year,
item.profit_loss.total_next_year, item.profit_loss.total_next_year,
item.profit_loss.total_more_year item.profit_loss.total_more_year,
item.order
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -151,7 +152,8 @@ export default class ProfitLoss extends Component { ...@@ -151,7 +152,8 @@ export default class ProfitLoss extends Component {
item.profit_loss.december, item.profit_loss.december,
item.profit_loss.total_current_year, item.profit_loss.total_current_year,
item.profit_loss.total_next_year, item.profit_loss.total_next_year,
item.profit_loss.total_more_year item.profit_loss.total_more_year,
item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -329,12 +331,13 @@ export default class ProfitLoss extends Component { ...@@ -329,12 +331,13 @@ export default class ProfitLoss extends Component {
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.order,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[23].length > 0) { if (item[24].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true })
} }
...@@ -389,7 +392,7 @@ export default class ProfitLoss extends Component { ...@@ -389,7 +392,7 @@ export default class ProfitLoss extends Component {
alert(response.data.status) alert(response.data.status)
} }
} else { } else {
this.setState({loading: false}) this.setState({ loading: false })
alert(response.problem) alert(response.problem)
// this.props.onClickClose() // this.props.onClickClose()
// this.props.getReport() // this.props.getReport()
...@@ -489,7 +492,7 @@ export default class ProfitLoss extends Component { ...@@ -489,7 +492,7 @@ export default class ProfitLoss extends Component {
total += Number(valItem) total += Number(valItem)
} }
}) })
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price" ) { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
dataTable2[tableMeta.rowIndex][20] = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20]) dataTable2[tableMeta.rowIndex][20] = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20]) let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
return value return value
...@@ -517,11 +520,64 @@ export default class ProfitLoss extends Component { ...@@ -517,11 +520,64 @@ export default class ProfitLoss extends Component {
// console.log(indexParent); // console.log(indexParent);
return a return a
} }
const handleFormula = (data, tableMeta) => { const handleFormula = (data, tableMeta, month) => {
let rilFormula = String(tableMeta.rowData[3])
if (rilFormula.includes('#')) {
if (this.props.status === "not-yet") {
let splitOrder = String(tableMeta.rowData[3]).split('@')
for (let index = 0; index < splitOrder.length; index++) {
if (splitOrder[index] === "") {
} else {
if (splitOrder[index].includes('#')) {
} else {
let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let reg = /^\d+$/
splitOperator.map((item) => {
if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item)
if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
}
}
})
}
}
}
let body = {
"submission_id": null,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
console.log(response);
})
} else {
let body = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
return response.data.data.result
}
}
})
}
} else {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[1] == item) let index = dataTable2.findIndex((val) => val[23] == item)
if (index > 0) { if (index > 0) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex]) arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else { } else {
...@@ -559,6 +615,49 @@ export default class ProfitLoss extends Component { ...@@ -559,6 +615,49 @@ export default class ProfitLoss extends Component {
}) })
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a return a
}
// console.log(rilFormula);
// let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
// let arrayJumlah = []
// arrayFormula.map((item, indexs) => {
// let index = dataTable2.findIndex((val) => val[1] == item)
// if (index > 0) {
// arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
// } else {
// arrayJumlah.push(item)
// }
// // if (indexs % 2 !== 0) {
// // operator.push(item)
// // }
// })
// let array = arrayJumlah
// let total = 0
// let opt = ""
// array.map((item, index) => {
// if (item == "+") {
// opt = "tambah"
// } else if (item == "-") {
// opt = "kurang"
// } else if (item == "*") {
// opt = "kali"
// } else if (item == "/") {
// opt = "bagi"
// } else {
// if (opt == "tambah") {
// total = Number(total) + Number(item)
// } else if (opt == "kurang") {
// total = Number(total) - Number(item)
// } else if (opt == "kali") {
// total = Number(total) * Number(item)
// } else if (opt == "bagi") {
// total = Number(total) / Number(item)
// } else {
// total += item
// }
// }
// })
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
// return a
} }
...@@ -599,8 +698,8 @@ export default class ProfitLoss extends Component { ...@@ -599,8 +698,8 @@ export default class ProfitLoss extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[23] ? {tableMeta.rowData[24] ?
tableMeta.rowData[23].length > 0 ? tableMeta.rowData[24].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow> <LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
...@@ -746,15 +845,15 @@ export default class ProfitLoss extends Component { ...@@ -746,15 +845,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1982,6 +2081,12 @@ export default class ProfitLoss extends Component { ...@@ -1982,6 +2081,12 @@ export default class ProfitLoss extends Component {
} }
} }
}, },
{
name: "",
options: {
display: false
}
},
{ {
name: "", name: "",
options: { options: {
...@@ -2256,7 +2361,7 @@ export default class ProfitLoss extends Component { ...@@ -2256,7 +2361,7 @@ export default class ProfitLoss extends Component {
this.uploadProfitLoss('draft') this.uploadProfitLoss('draft')
}, 100); }, 100);
})} })}
style={{ marginRight: 20}} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
......
import React, { Component } from "react"; import React, { Component } from "react";
import { createMuiTheme, MuiThemeProvider} from '@material-ui/core/styles'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import Images from "../../assets/Images"; import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import { InputBase, Snackbar, withStyles } from "@material-ui/core"; import { InputBase, Snackbar, Tooltip, withStyles } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
...@@ -17,6 +17,15 @@ import PopUpDelete from "../../library/PopUpDelete"; ...@@ -17,6 +17,15 @@ import PopUpDelete from "../../library/PopUpDelete";
import { css } from "@emotion/core"; import { css } from "@emotion/core";
import PropagateLoader from "react-spinners/PropagateLoader" import PropagateLoader from "react-spinners/PropagateLoader"
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
...@@ -150,12 +159,11 @@ export default class ReportItems extends Component { ...@@ -150,12 +159,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="reportname"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="reportname" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -175,12 +183,11 @@ export default class ReportItems extends Component { ...@@ -175,12 +183,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="companyname"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="companyname" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -200,12 +207,11 @@ export default class ReportItems extends Component { ...@@ -200,12 +207,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="order"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -225,12 +231,11 @@ export default class ReportItems extends Component { ...@@ -225,12 +231,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="desc"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="desc" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -250,12 +255,11 @@ export default class ReportItems extends Component { ...@@ -250,12 +255,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="parents"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="parents" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -275,12 +279,11 @@ export default class ReportItems extends Component { ...@@ -275,12 +279,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="uoms"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="uoms" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -300,12 +303,11 @@ export default class ReportItems extends Component { ...@@ -300,12 +303,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="weights"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="weights" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -325,12 +327,11 @@ export default class ReportItems extends Component { ...@@ -325,12 +327,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="datatype"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="datatype" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -350,12 +351,11 @@ export default class ReportItems extends Component { ...@@ -350,12 +351,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="formulas"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="formulas" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -375,12 +375,11 @@ export default class ReportItems extends Component { ...@@ -375,12 +375,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="values"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="values" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -400,12 +399,11 @@ export default class ReportItems extends Component { ...@@ -400,12 +399,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="conditions"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="conditions" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -425,12 +423,11 @@ export default class ReportItems extends Component { ...@@ -425,12 +423,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="kpi_type"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="kpi_type" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -450,12 +447,11 @@ export default class ReportItems extends Component { ...@@ -450,12 +447,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="max_ach"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="max_ach" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -475,12 +471,11 @@ export default class ReportItems extends Component { ...@@ -475,12 +471,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="formula_ytd"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="formula_ytd" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -500,12 +495,11 @@ export default class ReportItems extends Component { ...@@ -500,12 +495,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="startdate"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -525,12 +519,11 @@ export default class ReportItems extends Component { ...@@ -525,12 +519,11 @@ export default class ReportItems extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="enddate"> <LightTooltip title={tableMeta.rowData[16][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
...@@ -600,7 +593,7 @@ export default class ReportItems extends Component { ...@@ -600,7 +593,7 @@ export default class ReportItems extends Component {
} }
getData() { getData() {
this.setState({loading: true}) this.setState({ loading: true })
api.create().getReportItems().then((response) => { api.create().getReportItems().then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -612,7 +605,7 @@ export default class ReportItems extends Component { ...@@ -612,7 +605,7 @@ export default class ReportItems extends Component {
}) })
this.setState({ dataTable: listData, listData: response.data.data }, () => { this.setState({ dataTable: listData, listData: response.data.data }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({loading: false}) this.setState({ loading: false })
}, 2000); }, 2000);
}) })
} else { } else {
...@@ -718,6 +711,7 @@ export default class ReportItems extends Component { ...@@ -718,6 +711,7 @@ export default class ReportItems extends Component {
createReportItems = (payload) => { createReportItems = (payload) => {
this.setState({ add: false }) this.setState({ add: false })
api.create().createReportItems(payload).then(response => { api.create().createReportItems(payload).then(response => {
console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -1045,7 +1039,7 @@ export default class ReportItems extends Component { ...@@ -1045,7 +1039,7 @@ export default class ReportItems extends Component {
["", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"], ["", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"],
] ]
const loadingComponent = ( const loadingComponent = (
<div style={{position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)'}}> <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader <PropagateLoader
// css={override} // css={override}
size={20} size={20}
......
...@@ -203,8 +203,8 @@ export default class CreateReportItems extends Component { ...@@ -203,8 +203,8 @@ export default class CreateReportItems extends Component {
"weight": this.state.weight, "weight": this.state.weight,
"condition_if_wrong": this.state.condition, "condition_if_wrong": this.state.condition,
"condition_it_should_be": this.state.realVal, "condition_it_should_be": this.state.realVal,
"type_kpi": this.state.kpiTypeValue.value, "type_kpi": this.state.kpiTypeValue ? this.state.kpiTypeValue.value : null,
"max_ach": this.state.maxAchValue.value, "max_ach": this.state.maxAchValue ? this.state.maxAchValue.value : null,
"formula_ytd": this.state.formulaYTDValue, "formula_ytd": this.state.formulaYTDValue,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
......
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