Commit 826e2f22 authored by Riri Novita's avatar Riri Novita

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

Parameter Setting Currency USD

See merge request !1784
parents 8f1ec8c2 ee725aba
......@@ -184,6 +184,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')
// MASTER DATA - CAT
const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company')
......@@ -608,6 +609,7 @@ const create = (type = "") => {
getDetailReportMB,
deleteUnitBisnis,
deleteParameter,
getDataReport,
deletePerusahaan,
deleteReportItems,
getCarfmDocumentBySubmenu,
......
......@@ -221,6 +221,7 @@ export default class BalanceSheet extends Component {
}
}
})
console.log(dataTable);
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
......
......@@ -565,7 +565,6 @@ export default class FixedAssetsMovement extends Component {
if (Bfr !== undefined) {
let data = 24
let period = Number(this.props.periode) - 1
// console.log(dataTable2[tableMeta.rowIndex][data])
anjay.push(0)
let indexID = dataTable2[tableMeta.rowIndex][data].findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == period)
if (indexID !== -1) {
......@@ -952,7 +951,8 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleBfr(value, tableMeta)).toFixed(1)}
value={Number(value).toFixed(1)}
// value={Number(handleBfr(value, tableMeta)).toFixed(1)}
/>
}
/>
......
......@@ -13,6 +13,7 @@ export default class CreateParameter extends Component {
super(props)
this.state = {
enableParameter: false,
enableReportName: false,
id: '',
description: '',
value: '',
......@@ -27,6 +28,8 @@ export default class CreateParameter extends Component {
types: null,
getTypes: null,
perusahaan: null,
reportName: null,
getReportName: null,
getPerusahaan: null,
parameter: null,
getParameter: null,
......@@ -35,6 +38,7 @@ export default class CreateParameter extends Component {
tempData: null,
errorParameter: false,
errorDeskripsi: false,
errorReportName: false,
errorValue: false,
errorMinValue: false,
errorOrder: false,
......@@ -47,6 +51,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -67,12 +72,13 @@ export default class CreateParameter extends Component {
})
this.getDataGroup()
this.getDataPerusahaan()
this.getDataReportName()
}
}
getDetailParameter() {
api.create().getDetailParameter(this.props.data[0]).then((response) => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......@@ -82,11 +88,15 @@ export default class CreateParameter extends Component {
getSettingGroupID: response.data.data.setting_group_id,
getCompanyID: data.company_id,
settingType: data.setting_type,
getSettingTypeID: data.setting_type_id
getSettingTypeID: data.setting_type_id,
typeReport: data.type_report_name,
getTypeReportID: data.type_report_id,
enableReportName: data.setting_group === "CURRENCY" ? true : false
}, () => {
this.getAllGroup()
this.getPerusahaan()
// console.log(this.state.tempData)
this.getReport()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -109,7 +119,6 @@ export default class CreateParameter extends Component {
getAllGroup() {
api.create().getAllGroup().then(response => {
// console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......@@ -126,7 +135,7 @@ export default class CreateParameter extends Component {
getOptionLabel: (option) => option.setting_group_name,
};
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0] : typeData[index] }, () => {
this.getParameterByGroup(this.state.getTypes.setting_group_id)
this.getParameterByGroup(this.state.getTypes.setting_group_id, this.state.getTypes.setting_group_name)
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -188,6 +197,43 @@ export default class CreateParameter extends Component {
})
}
getReport() {
api.create().getDataReport().then(response => {
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
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
}
})
let index = reportData.findIndex((val) => val.type_report_id == this.state.getTypeReportID)
let reportProps = {
options: reportData,
getOptionLabel: (option) => option.type_report_name,
};
this.setState({ reportName: reportProps, reportData: response.data.data, getReportName: index == -1 ? reportData[0] : reportData[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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
getDataGroup() {
api.create().getAllGroup().then((response) => {
if (response.data) {
......@@ -264,7 +310,12 @@ export default class CreateParameter extends Component {
})
}
getParameterByGroup(id) {
getParameterByGroup(id, name) {
if (name === "CURRENCY") {
this.setState({ enableReportName: true })
} else {
this.setState({ enableReportName: false })
}
api.create().getParameterByGroup(id).then(response => {
// console.log(id, response);
if (response.data) {
......@@ -302,6 +353,71 @@ export default class CreateParameter extends Component {
})
}
getDataReportName() {
api.create().getDataReport().then((response) => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
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
}
})
let reportProps = {
options: reportData,
getOptionLabel: (option) => option.type_report_name,
};
this.setState({ reportName: reportProps, reportData: response.data.data })
} 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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
// let reportData = [
// {
// "type_report_id": 1,
// "report_name": "Master Budget"
// },
// {
// "type_report_id": 2,
// "report_name": "Monthly Report"
// },
// {
// "type_report_id": 3,
// "report_name": "Rolling Outlook"
// },
// {
// "type_report_id": 4,
// "report_name": "Outlook PA"
// },
// {
// "type_report_id": 5,
// "report_name": "Operating Indicator"
// }
// ]
// let reportProps = {
// options: reportData.sort((a, b) => a.report_id - b.report_id),
// getOptionLabel: (option) => option.report_name,
// };
// this.setState({ reportName: reportProps })
}
handleChange(e, type) {
let data = this.state
let isDate = type !== '' ? true : false
......@@ -310,6 +426,7 @@ export default class CreateParameter extends Component {
...data, tempData: { ...this.state.tempData, start_date: format(e, 'yyyy-MM-dd'), end_date: null },
errorParameter: false,
errorDeskripsi: false,
errorReportName: false,
errorValue: false,
errorMinValue: false,
errorOrder: false,
......@@ -322,6 +439,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -334,6 +452,7 @@ export default class CreateParameter extends Component {
...data, tempData: { ...this.state.tempData, end_date: format(e, 'yyyy-MM-dd') },
errorParameter: false,
errorDeskripsi: false,
errorReportName: false,
errorValue: false,
errorMinValue: false,
errorOrder: false,
......@@ -346,6 +465,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -359,6 +479,7 @@ export default class CreateParameter extends Component {
tempData: { ...this.state.tempData, [e.target.name]: e.target.value },
errorParameter: false,
errorDeskripsi: false,
errorReportName: false,
errorValue: false,
errorMinValue: false,
errorOrder: false,
......@@ -371,6 +492,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -388,6 +510,7 @@ export default class CreateParameter extends Component {
errorValue: false,
errorMinValue: false,
errorOrder: false,
errorReportName: false,
errorMaxValue: false,
errorStartDate: false,
errorEndDate: false,
......@@ -402,7 +525,8 @@ export default class CreateParameter extends Component {
msgErrorOrder: '',
msgErrorMaxValue: '',
msgErrorStartDate: '',
msgErrorEndDate: ''
msgErrorEndDate: '',
msgErrorReportName: ''
})
}
......@@ -431,6 +555,8 @@ export default class CreateParameter extends Component {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
// } else if (R.isEmpty(this.state.tempData.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
} else if (this.state.getTypes.setting_group_name === "CURRENCY" && R.isNil(this.state.getReportName)) {
this.setState({ errorReportName: true, msgErrorReportName: 'Report Name Cannot be Empty' })
} else if (R.isEmpty(this.state.tempData.value) && R.isEmpty(this.state.tempData.min_value) && R.isEmpty(this.state.tempData.max_value)) {
this.setState({ errorValue: true, msgErrorValue: 'Value Cannot be Empty' })
} else if ((!R.isEmpty(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) {
......@@ -449,6 +575,7 @@ export default class CreateParameter extends Component {
}
validasiCreate() {
console.log(this.state.getTypes);
if (R.isNil(this.state.getTypes)) {
this.setState({ errorGroup: true, msgErrorGroup: 'Group Cannot be Empty' })
} else if (R.isNil(this.state.getParameter)) {
......@@ -457,6 +584,8 @@ export default class CreateParameter extends Component {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
// } else if (R.isEmpty(this.state.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
} else if (this.state.getTypes.setting_group_name === "CURRENCY" && R.isNil(this.state.getReportName)) {
this.setState({ errorReportName: true, msgErrorReportName: 'Report Name Cannot be Empty' })
} else if ((R.isEmpty(this.state.value) && R.isEmpty(this.state.maxValue) && R.isEmpty(this.state.minValue))) {
this.setState({ errorValue: true, msgErrorValue: 'Value Cannot be Empty' })
} else if ((!R.isEmpty(this.state.maxValue) && R.isEmpty(this.state.minValue))) {
......@@ -480,6 +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,
"description": this.state.tempData.description,
"orders": this.state.tempData.order,
"value": this.state.tempData.value,
......@@ -497,6 +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,
"description": this.state.description,
"orders": this.state.order,
"value": this.state.value,
......@@ -728,7 +859,7 @@ export default class CreateParameter extends Component {
{...this.state.types}
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, getParameter: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id), this.clearMessage())}
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, enableReportName: false, getParameter: null, getReportName: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id, newInputValue.setting_group_name), this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
......@@ -792,6 +923,28 @@ export default class CreateParameter extends Component {
>
</TextField>
</div>
{this.state.enableReportName &&
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.reportName}
debug
id="report"
onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Report Name"
// error={this.state.errorPerusahaan}
// helperText={this.state.msgErrorPerusahaan}
/>}
value={this.state.getReportName}
/>
</div>
}
<div style={{ marginTop: '80px', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
......@@ -1111,7 +1264,7 @@ export default class CreateParameter extends Component {
{...this.state.types}
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, getParameter: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id), this.clearMessage())}
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, enableReportName: false, getParameter: null, getReportName: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id, newInputValue.setting_group_name), this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
......@@ -1175,6 +1328,28 @@ export default class CreateParameter extends Component {
>
</TextField>
</div>
{this.state.enableReportName &&
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.reportName}
debug
id="report"
onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Report Name"
error={this.state.errorReportName}
helperText={this.state.msgErrorReportName}
/>}
value={this.state.getReportName}
/>
</div>
}
<div style={{ marginTop: '80px', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
......
......@@ -107,7 +107,7 @@ export default class Parameter extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
// console.log(response);
console.log(response);
let data = response.data.data
let listData = data.map((item, index) => {
return [
......@@ -308,6 +308,7 @@ export default class Parameter extends Component {
else {
// let judul = resp.rows[2]
let isi = resp.rows.slice(3)
console.log(isi);
let payload = []
isi.map((item, index) => {
if (item.length > 0) {
......@@ -316,13 +317,14 @@ export default class Parameter extends Component {
group: item[0] === undefined ? "" : item[0],
parameter: item[1] === undefined ? "" : item[1],
company: item[2] === undefined ? "" : item[2],
description: item[3] === undefined ? "" : item[3],
orders: item[4] === undefined ? "" : item[4],
value: item[5] === undefined ? "" : item[5],
min_value: item[6] === undefined ? "" : item[6],
max_value: item[7] === undefined ? "" : item[7],
start_date: item[8] === undefined ? "" : item[8],
end_date: item[9] === undefined ? "" : item[9],
type_report: item[3] === undefined ? "" : item[3],
description: item[4] === undefined ? "" : item[4],
orders: item[5] === undefined ? "" : item[5],
value: item[6] === undefined ? "" : item[6],
min_value: item[7] === undefined ? "" : item[7],
max_value: item[8] === undefined ? "" : item[8],
start_date: item[9] === undefined ? "" : item[9],
end_date: item[10] === undefined ? "" : item[10],
})
}
})
......@@ -337,7 +339,7 @@ export default class Parameter extends Component {
checkUpload() {
api.create().checkUploadParameter(this.state.payload).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
......@@ -347,6 +349,7 @@ export default class Parameter extends Component {
item.group,
item.parameter,
item.company,
item.type_report,
item.description,
item.orders,
item.value,
......@@ -363,17 +366,18 @@ export default class Parameter extends Component {
name: "Group",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta);
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('group'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('group'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -388,16 +392,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('parameter'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('parameter'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -412,16 +416,40 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('company'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('company'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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: "Type Report",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('type_report'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -436,16 +464,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('description'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('description'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -460,16 +488,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('order'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('order'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -484,16 +512,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('value'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('value'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -508,16 +536,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('min_value'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('min_value'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -532,16 +560,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('max_value'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('max_value'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -556,16 +584,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('start_date'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -580,16 +608,16 @@ export default class Parameter extends Component {
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[11] != null) {
check = tableMeta.rowData[11].findIndex((val) => val.field.includes('end_date'))
if (tableMeta.rowData[12] != null) {
check = tableMeta.rowData[12].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[11][check].message} arrow>
{tableMeta.rowData[12] != null && check > -1 ?
<LightTooltip title={tableMeta.rowData[12][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>
......@@ -647,7 +675,7 @@ export default class Parameter extends Component {
uploadParameter() {
api.create().uploadParameter(this.state.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