Commit e5e263bc authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

upload cat mr

See merge request !804
parents 9e958691 d25b96d9
......@@ -243,6 +243,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
else {
let isi = resp.rows.slice(3)
console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -251,9 +252,9 @@ export default class CorporateAnnualTargetMR extends Component {
orders: i[0] === undefined ? "" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
wight: i[3] === undefined ? "" : (String(i[3])) === false ? "0" : String(i[3]).trim(),
weight: i[3] === undefined ? "" : (String(i[3])) === false ? "0" : String(i[3]).trim(),
oum: i[4] === undefined ? "" : (String(i[4])) === false ? "0" : String(i[4]).trim(),
kpi_type: i[5] === undefined ? "" : (String(i[5])) === false ? "0" : String(i[5]).trim(),
jenis_kpi: i[5] === undefined ? "" : (String(i[5])) === false ? "0" : String(i[5]).trim(),
max_ach: i[6] === undefined ? "" : (String(i[6])) === false ? "0" : String(i[6]).trim(),
actual_monthly: i[7] === undefined ? "0.0" : (String(i[7])) === false ? "0" : String(i[7]).trim(),
notes: i[8] === undefined ? "" : (String(i[8])) === false ? "0" : String(i[8]).trim(),
......@@ -276,8 +277,8 @@ export default class CorporateAnnualTargetMR extends Component {
checkUpload() {
api.create().checkUploadMonthlyReportCAT(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload));
// console.log(this.state.payload)
// console.log(response)
console.log(this.state.payload)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, loading: true, visibleCATMR: false })
......@@ -293,19 +294,21 @@ export default class CorporateAnnualTargetMR extends Component {
item.uom,
item.kpi_type,
item.max_ach,
item.formula,
item.formula_ytd,
item.actual_monthly,
item.target_monthly,
item.achivement_monthly,
item.score,
item.score_x_weight,
item.notes
item.notes,
item.order,
item.error
]
})
console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[18].length > 0) {
if (item[16].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
......@@ -323,7 +326,7 @@ export default class CorporateAnnualTargetMR extends Component {
data.push({
item_report_id: i[1],
item_report: String(i[5]).trim(),
wight: String(i[6]),
weight: String(i[6]),
uom: String(i[7]),
jenis_kpi: i[8] == null ? "" : i[8].value,
max_ach: i[9] == null ? "" : i[9].value,
......@@ -344,7 +347,6 @@ export default class CorporateAnnualTargetMR extends Component {
"status": type,
"months": this.props.month.month_id,
"corporate_annual_target": data
// "fixed_asset_movement": data
}
console.log(data);
api.create('UPLOAD').uploadMonthlyReportCAT(body).then(response => {
......@@ -561,7 +563,7 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(data);
let index = 0
if (value == null) {
console.log("masuk");
// console.log("masuk");
index = -1
} else {
index = data.findIndex((val) => val.value == value.value)
......@@ -1483,7 +1485,6 @@ export default class CorporateAnnualTargetMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{ console.log(this.state.loading) }
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
......
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