Commit f6b3a4fb authored by rifkaki's avatar rifkaki

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

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