Commit ee725aba authored by Riri Novita's avatar Riri Novita

Parameter Setting Currency USD

parent 8083f146
......@@ -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,
......
......@@ -38,6 +38,7 @@ export default class CreateParameter extends Component {
tempData: null,
errorParameter: false,
errorDeskripsi: false,
errorReportName: false,
errorValue: false,
errorMinValue: false,
errorOrder: false,
......@@ -50,6 +51,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -76,7 +78,7 @@ export default class CreateParameter extends Component {
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') {
......@@ -86,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' }, () => {
......@@ -129,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' }, () => {
......@@ -191,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) {
......@@ -267,11 +310,11 @@ export default class CreateParameter extends Component {
})
}
getParameterByGroup(id) {
if (id === 13) {
this.setState({ enableReportName: true})
getParameterByGroup(id, name) {
if (name === "CURRENCY") {
this.setState({ enableReportName: true })
} else {
this.setState({ enableReportName: false})
this.setState({ enableReportName: false })
}
api.create().getParameterByGroup(id).then(response => {
// console.log(id, response);
......@@ -311,82 +354,68 @@ export default class CreateParameter extends Component {
}
getDataReportName() {
let reportData = [
{
"report_id": 12,
"report_name": "Master Budget"
},
{
"report_id": 16,
"report_name": "Monthly Report - Jan"
},
{
"report_id": 17,
"report_name": "Monthly Report - Feb"
},
{
"report_id": 18,
"report_name": "Monthly Report - Mar"
},
{
"report_id": 19,
"report_name": "Monthly Report - Apr"
},
{
"report_id": 20,
"report_name": "Monthly Report - May"
},
{
"report_id": 21,
"report_name": "Monthly Report - Jun"
},
{
"report_id": 22,
"report_name": "Monthly Report - Jul"
},
{
"report_id": 23,
"report_name": "Monthly Report - Aug"
},
{
"report_id": 24,
"report_name": "Monthly Report - Sep"
},
{
"report_id": 25,
"report_name": "Monthly Report - Oct"
},
{
"report_id": 26,
"report_name": "Monthly Report - Nov"
},
{
"report_id": 27,
"report_name": "Monthly Report - Dec"
},
{
"report_id": 13,
"report_name": "Rolling Outlook Q1"
},
{
"report_id": 14,
"report_name": "Rolling Outlook Q2"
},
{
"report_id": 16,
"report_name": "Rolling Outlook Q3"
},
{
"report_id": 11,
"report_name": "Operating Indicator"
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.sort((a, b) => a.report_id - b.report_id),
getOptionLabel: (option) => option.report_name,
options: reportData,
getOptionLabel: (option) => option.type_report_name,
};
this.setState({ reportName: reportProps })
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) {
......@@ -397,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,
......@@ -409,6 +439,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -421,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,
......@@ -433,6 +465,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -446,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,
......@@ -458,6 +492,7 @@ export default class CreateParameter extends Component {
msgErrorGroup: '',
msgErrorParameter: '',
msgErrorDeskripsi: '',
msgErrorReportName: '',
msgErrorValue: '',
msgErrorMinValue: '',
msgErrorOrder: '',
......@@ -475,6 +510,7 @@ export default class CreateParameter extends Component {
errorValue: false,
errorMinValue: false,
errorOrder: false,
errorReportName: false,
errorMaxValue: false,
errorStartDate: false,
errorEndDate: false,
......@@ -489,7 +525,8 @@ export default class CreateParameter extends Component {
msgErrorOrder: '',
msgErrorMaxValue: '',
msgErrorStartDate: '',
msgErrorEndDate: ''
msgErrorEndDate: '',
msgErrorReportName: ''
})
}
......@@ -518,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))) {
......@@ -536,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)) {
......@@ -544,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))) {
......@@ -567,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,
......@@ -584,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,
......@@ -815,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}
......@@ -879,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%' }}
......@@ -1198,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, enableReportName: 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}
......@@ -1276,8 +1342,8 @@ export default class CreateParameter extends Component {
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Report Name"
// error={this.state.errorPerusahaan}
// helperText={this.state.msgErrorPerusahaan}
error={this.state.errorReportName}
helperText={this.state.msgErrorReportName}
/>}
value={this.state.getReportName}
/>
......
......@@ -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