Commit 0dd4add5 authored by faisalhamdi's avatar faisalhamdi

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

parents 27a5c44f 1b1a7da4
......@@ -283,6 +283,7 @@ const create = (type = "") => {
const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body)
const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report/validate_save', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......@@ -508,7 +509,8 @@ const create = (type = "") => {
uploadMonthlyReportFAM,
uploadMonthlyReportTP,
uploadMonthlyReportOI,
getHierarkiMontlyReportCF
getHierarkiMontlyReportCF,
validateSubmitReportMR
}
}
......
......@@ -439,6 +439,63 @@ export default class BalanceSheetMR extends Component {
})
}
handleValidate() {
let data = []
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"rolling_outlook": i[6],
"master_budget": i[7],
"rolling_budget": i[8],
"actual": i[9],
"actual_previous_month": i[10],
"amount_act_vs_previous_month": i[11],
"percent_act_vs_previous_month": i[12],
"amount_act_vs_mb": i[13],
"percent_act_vs_mb": i[14],
"amount_act_vs_rb": i[15],
"percent_act_vs_rb": i[16],
"mtd_vs_previous_month": i[17],
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
})
})
// console.log(JSON.stringify(data))
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": "submitted",
"months": this.props.month.month_id,
"balance_sheet": data
}
api.create().validateSubmitReportMR(payload).then((response) => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
......@@ -1811,8 +1868,7 @@ export default class BalanceSheetMR extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
this.handleValidate()
}, 100);
})
}}
......@@ -1846,7 +1902,7 @@ export default class BalanceSheetMR extends Component {
</button>
<button
type="button"
// disabled={this.state.buttonError}
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
......@@ -1928,8 +1984,7 @@ export default class BalanceSheetMR extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
this.handleValidate()
}, 100);
})
}}
......@@ -1963,7 +2018,7 @@ export default class BalanceSheetMR extends Component {
</button>
<button
type="button"
// disabled={this.state.buttonError}
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
......
......@@ -74,6 +74,7 @@ export default class OperatingIndicatorMR extends Component {
// this.getItemHierarki()
this.getSettingControl()
this.getLatestUpdate()
console.log(this.props.permission.create);
}
getSettingControl() {
......@@ -852,7 +853,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(tableMeta.rowData[10]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1119,7 +1120,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(tableMeta.rowData[15]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1175,7 +1176,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
value={Number(tableMeta.rowData[16]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1573,7 +1574,7 @@ export default class OperatingIndicatorMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MONTHLY REPORT - MONTHLY REPORT" ?
String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
This diff is collapsed.
......@@ -62,7 +62,7 @@ export default class OperatingIndicator extends Component {
menu: "operating indicator"
}
api.create().getPermission(payload).then(response => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
......@@ -321,7 +321,7 @@ export default class OperatingIndicator extends Component {
visibleDetailRolling: false,
months: id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : 0
}, () => console.log(this.state.dataDetail))
})
} else {
this.setState({
......
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