Commit d7116481 authored by Riri Novita's avatar Riri Novita

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

update banyak banget (currency)

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