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