Commit d7116481 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

update banyak banget (currency)

See merge request !1786
parents 826e2f22 cf7fe1f8
......@@ -127,6 +127,8 @@ const create = (type = "") => {
const uploadPerusahaan = (body) => api.post('company/import_company', body)
const searchPerusahaan = (body) => api.post('company/search_company', body)
const deletePerusahaan = (id) => api.post(`company/delete_company/${id}`)
const getDataCurrency = () => api.get('multi_currency/get_all_currency')
// APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_approval_matrix')
......@@ -184,7 +186,7 @@ const create = (type = "") => {
const uploadParameter = (body) => api.post('/setting/import_setting', body)
const searchParameter = (body) => api.post('setting/search_setting', body)
const deleteParameter = (id) => api.post(`setting/delete_setting/${id}`)
const getDataReport = () => api.get('type_report/get_all_type_report')
const getDataReport = () => api.get('setting_type/get_all_setting_type_by_report_submit_period_group')
// MASTER DATA - CAT
const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company')
......@@ -611,6 +613,7 @@ const create = (type = "") => {
deleteParameter,
getDataReport,
deletePerusahaan,
getDataCurrency,
deleteReportItems,
getCarfmDocumentBySubmenu,
getDocumentCategory,
......
......@@ -72,7 +72,7 @@ export default class ProfitLoss extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
// console.log(this.props);
console.log(this.props);
}
getLatestUpdate() {
......
......@@ -415,6 +415,7 @@ export default class Perusahaan extends Component {
createPerusahaan = (payload) => {
this.setState({ visibleCreate: false })
api.create().createPerusahaan(payload).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......
......@@ -8,6 +8,7 @@ import MuiAlert from '@material-ui/lab/Alert';
import api from '../../../api';
import Images from '../../../assets/Images';
import Constant from '../../../library/Constant';
import { DataUsage } from '@material-ui/icons';
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
......@@ -26,6 +27,10 @@ export default class CreatePerusahaan extends Component {
endDate: '',
status: '',
types: null,
dataCurrency: [],
currency: [],
currencies: [],
defaultCurrency: null,
getTypes: null,
perusahaan: null,
getPerusahaan: null,
......@@ -55,10 +60,12 @@ export default class CreatePerusahaan extends Component {
componentDidMount() {
if (this.props.type === 'edit') {
this.getDetailPerusahaan()
this.getListCurrency()
// console.log(this.props.data);
} else {
this.getCompanyActive()
this.getAllUnitBisnis()
this.getListCurrency()
let date = format(new Date, 'yyyy-MM-dd')
// console.log(date);
this.setState({
......@@ -74,6 +81,19 @@ export default class CreatePerusahaan extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
let datas = []
if (response.data.data.currency.length > 0) {
response.data.data.currency.map((item) => {
console.log(item);
datas.push({
id: item.currencyId,
value: item.currencyName
})
})
// console.log(response.data.data.default_currency, datas);
}
let index = datas.findIndex((val) => val.id == response.data.data.default_currency)
this.setState({
businessID: response.data.data.business_unit_id,
companyID: response.data.data.company_id,
......@@ -85,7 +105,10 @@ export default class CreatePerusahaan extends Component {
endDate: response.data.data.end_date,
totalReport: response.data.data.total_report,
created: response.data.data.created,
updated: response.data.data.updated === null ? "" : response.data.data.updated
updated: response.data.data.updated === null ? "" : response.data.data.updated,
defaultCurrencyID: response.data.data.default_currency,
currency: datas,
defaultCurrency: index == -1 ? null : datas[index]
}, () => {
// setTimeout(() => {
this.getAllUnitBisnis()
......@@ -180,7 +203,7 @@ export default class CreatePerusahaan extends Component {
business_unit_name: item.business_unit_name
}
})
// console.log(typeData)
console.log(typeData)
let index = typeData.findIndex((val) => val.business_unit_id == this.state.businessID)
console.log(index)
let typeProps = {
......@@ -211,6 +234,22 @@ export default class CreatePerusahaan extends Component {
})
}
getListCurrency() {
api.create().getDataCurrency().then(response => {
console.log(response);
if (response.data) {
let arrayCurrency = []
response.data.data.map(item => {
arrayCurrency.push({
id: item.currency_id,
value: item.currency_name
})
})
this.setState({ dataCurrency: arrayCurrency })
}
})
}
// getParentCompany() {
// api.create().getPerusahaanActive().then((response) => {
// if (response.data.status === 'success') {
......@@ -280,6 +319,12 @@ export default class CreatePerusahaan extends Component {
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorED: true, msgErrorED: 'Valid To Cannot be Empty' })
} else {
let currencyID = []
if (this.state.currency.length > 0) {
this.state.currency.map(item => {
currencyID.push(item.id)
})
}
let payload = {
"company_id": this.state.companyID,
"company_name": this.state.company,
......@@ -287,8 +332,11 @@ export default class CreatePerusahaan extends Component {
// "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan.company_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate
"end_date": this.state.endDate,
"default_currency": this.state.defaultCurrency.id,
"currency": currencyID
}
// console.log(payload);
this.props.updatePerusahaan(payload)
}
}
......@@ -306,15 +354,23 @@ export default class CreatePerusahaan extends Component {
this.setState({ errorED: true, msgErrorED: 'Valid To Cannot be Empty.' })
}
else {
let currencyID = []
if (this.state.currency.length > 0) {
this.state.currency.map(item => {
currencyID.push(item.id)
})
}
let payload = {
"company_name": this.state.company,
// "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan.company_id,
"business_unit_id": this.state.getTypes.business_unit_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate
"end_date": this.state.endDate,
"default_currency": this.state.defaultCurrency.id,
"currency": currencyID
}
console.log(payload);
// console.log(payload);
this.props.createPerusahaan(payload)
}
}
......@@ -391,6 +447,32 @@ export default class CreatePerusahaan extends Component {
value={this.state.getTypes}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
multiple
options={this.state.dataCurrency}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue }, () => {
if (this.state.defaultCurrency) {
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id)
this.setState({ defaultCurrency: result })
}
})}
renderInput={(params) => (
<TextField
{...params}
variant="standard"
label="Currency"
margin="normal"
style={{ marginTop: 0 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
)}
value={this.state.currency}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
......@@ -483,6 +565,28 @@ export default class CreatePerusahaan extends Component {
value={this.state.getPerusahaan}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
disableClearable={!this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Default Currency"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
......@@ -617,6 +721,33 @@ export default class CreatePerusahaan extends Component {
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
multiple
options={this.state.dataCurrency}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue }, () => {
if (this.state.defaultCurrency) {
console.log("tes");
const result = this.state.currency.find((elem) => elem.id === this.state.defaultCurrency.id)
this.setState({ defaultCurrency: result })
}
})}
renderInput={(params) => (
<TextField
{...params}
variant="standard"
label="Currency"
margin="normal"
style={{ marginTop: 0 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
)}
value={this.state.currency}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
......@@ -713,6 +844,29 @@ export default class CreatePerusahaan extends Component {
value={this.state.perusahaan}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
disableClearable={!this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Default Currency"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
......
......@@ -89,8 +89,8 @@ export default class CreateParameter extends Component {
getCompanyID: data.company_id,
settingType: data.setting_type,
getSettingTypeID: data.setting_type_id,
typeReport: data.type_report_name,
getTypeReportID: data.type_report_id,
typeReport: data.setting_type_name,
getTypeReportID: data.setting_type_id,
enableReportName: data.setting_group === "CURRENCY" ? true : false
}, () => {
......@@ -205,14 +205,14 @@ export default class CreateParameter extends Component {
let data = response.data.data
let reportData = data.map((item) => {
return {
type_report_id: item.type_report_id,
type_report_name: item.type_report_name
setting_type_id: item.setting_type_id,
setting_type_name: item.setting_type_name
}
})
let index = reportData.findIndex((val) => val.type_report_id == this.state.getTypeReportID)
let index = reportData.findIndex((val) => val.setting_type_id == this.state.getTypeReportID)
let reportProps = {
options: reportData,
getOptionLabel: (option) => option.type_report_name,
getOptionLabel: (option) => option.setting_type_name,
};
this.setState({ reportName: reportProps, reportData: response.data.data, getReportName: index == -1 ? reportData[0] : reportData[index] })
} else {
......@@ -362,13 +362,13 @@ export default class CreateParameter extends Component {
let data = response.data.data
let reportData = data.map((item) => {
return {
type_report_id: item.type_report_id,
type_report_name: item.type_report_name
setting_type_id: item.setting_type_id,
setting_type_name: item.setting_type_name
}
})
let reportProps = {
options: reportData,
getOptionLabel: (option) => option.type_report_name,
getOptionLabel: (option) => option.setting_type_name,
};
this.setState({ reportName: reportProps, reportData: response.data.data })
} else {
......@@ -609,7 +609,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_id,
"type_report_id": this.state.getReportName.type_report_id,
"reference_id": this.state.getReportName.setting_type_id,
"description": this.state.tempData.description,
"orders": this.state.tempData.order,
"value": this.state.tempData.value,
......@@ -627,7 +627,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_id,
"type_report_id": this.state.getReportName.type_report_id,
"reference_id": this.state.getReportName.setting_type_id,
"description": this.state.description,
"orders": this.state.order,
"value": this.state.value,
......
......@@ -317,7 +317,7 @@ export default class Parameter extends Component {
group: item[0] === undefined ? "" : item[0],
parameter: item[1] === undefined ? "" : item[1],
company: item[2] === undefined ? "" : item[2],
type_report: item[3] === undefined ? "" : item[3],
reference: item[3] === undefined ? "" : item[3],
description: item[4] === undefined ? "" : item[4],
orders: item[5] === undefined ? "" : item[5],
value: item[6] === undefined ? "" : item[6],
......@@ -349,7 +349,7 @@ export default class Parameter extends Component {
item.group,
item.parameter,
item.company,
item.type_report,
item.reference,
item.description,
item.orders,
item.value,
......@@ -674,6 +674,7 @@ export default class Parameter extends Component {
}
uploadParameter() {
console.log(this.state.payload);
api.create().uploadParameter(this.state.payload).then(response => {
console.log(response)
if (response.data) {
......
......@@ -72,7 +72,18 @@ export default class CreateReportItems extends Component {
maxAchValue: null,
formulaYTDValue: null,
kpiDisable: true,
maxAchDisable: true
maxAchDisable: true,
convertible: null,
listConvert: [
{
"id": 0,
"value": "No"
},
{
"id": 1,
"value": "Yes"
}
],
}
}
......@@ -209,7 +220,8 @@ export default class CreateReportItems extends Component {
"max_ach": this.state.maxAchValue ? this.state.maxAchValue.value : null,
"formula_ytd": this.state.formulaYTDValue,
"start_date": this.state.startDate,
"end_date": this.state.endDate
"end_date": this.state.endDate,
"is_can_convert_value": this.state.convertible.id
}
// console.log(payload)
this.props.createReportItems(payload)
......@@ -1047,6 +1059,28 @@ export default class CreateReportItems extends Component {
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.listConvert}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ convertible: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
label="Convertible"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div className="column-2" style={{ marginTop: 7}}>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
......
......@@ -72,7 +72,18 @@ export default class EditReportItems extends Component {
formulaYtd: ['SUM', 'AVG', 'LAST', 'FORMULA'],
kpiTypeValue: null,
maxAchValue: null,
formulaYTDValue: null
formulaYTDValue: null,
convertible: null,
listConvert: [
{
"id": 0,
"value": "No"
},
{
"id": 1,
"value": "Yes"
}
],
}
}
......@@ -183,7 +194,8 @@ export default class EditReportItems extends Component {
"max_ach": this.state.tempData.max_ach,
"formula_ytd": this.state.tempData.formula_ytd,
"start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date
"end_date": this.state.tempData.end_date,
"is_can_convert_value": this.state.convertible.id
}
// console.log(payload)
this.props.updateReportItems(payload)
......@@ -191,17 +203,20 @@ export default class EditReportItems extends Component {
getDetailReportItems() {
api.create().getDetailReportItems(this.props.data[1]).then((response) => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
let index = this.state.listConvert.findIndex((val) => val.id === data.is_can_convert_value)
this.setState({
tempData: response.data.data,
getCompanyID: data.company_id
getCompanyID: data.company_id,
convertible: index === -1 ? null : this.state.listConvert[index]
}, () => this.getInputType(),
this.getPerusahaan(),
this.getReportType())
// console.log(response.data.data)
// console.log(this.state.convertible)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -328,7 +343,7 @@ export default class EditReportItems extends Component {
getOptionLabel: (option) => titleCase(option.value),
};
let index = inputKPI.findIndex((val) => val.value === this.state.tempData.kpi_type)
this.setState({ listKPI: defaultProps, inputKPI: response.data.data, KPIValue: index === -1 ? null : inputKPI[index]})
this.setState({ listKPI: defaultProps, inputKPI: response.data.data, KPIValue: index === -1 ? null : inputKPI[index] })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -1017,6 +1032,29 @@ export default class EditReportItems extends Component {
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.listConvert}
getOptionLabel={(option) => option.value}
value={this.state.convertible}
onChange={(event, newInputValue) => this.setState({ convertible: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
label="Convertible"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
......
......@@ -97,6 +97,7 @@ export default class ReportItems extends Component {
formula_ytd: item[13] === undefined ? "" : item[13],
start_date: item[14] === undefined ? "" : item[14],
end_date: item[15] === undefined ? "" : item[15],
is_can_convert_value: item[16] === undefined ? "" : item[16],
})
}
})
......@@ -104,7 +105,7 @@ export default class ReportItems extends Component {
item_report: payload
}
if (resp.rows[2].length !== 16) {
if (resp.rows[2].length !== 17) {
this.setState({ invalidTemplate: true })
} else {
this.setState({ invalidTemplate: false })
......@@ -141,7 +142,8 @@ export default class ReportItems extends Component {
item.formula_ytd,
item.start_date,
item.end_date,
item.error
item.is_can_convert_value,
item.error,
]
})
let columns = [
......@@ -150,16 +152,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('report_type'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('report_type'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -174,16 +176,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('company'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('company'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -198,16 +200,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('orders'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('orders'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
......@@ -222,16 +224,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('description'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('description'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -246,16 +248,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('parent'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('parent'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -270,16 +272,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('uom'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('uom'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -294,16 +296,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('weight'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('weight'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -318,16 +320,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('type_report'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('type_report'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -342,16 +344,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('formula'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('formula'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -366,16 +368,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('condition_it_should_be'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('condition_it_should_be'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -390,16 +392,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('condition_if_wrong'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('condition_if_wrong'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -414,16 +416,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('kpi_type'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('kpi_type'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -438,16 +440,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('max_ach'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('max_ach'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -462,16 +464,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('formula_ytd'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('formula_ytd'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
......@@ -486,16 +488,16 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('start_date'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -510,16 +512,40 @@ export default class ReportItems extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('end_date'))
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[16][check].message} arrow>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
}
</div >
);
}
}
},
{
name: "Convertible",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('company'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[17] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[17][check].message} arrow>
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</LightTooltip> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
......@@ -725,7 +751,7 @@ export default class ReportItems extends Component {
createReportItems = (payload) => {
this.setState({ add: false })
api.create().createReportItems(payload).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......
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