Commit e4bf28c1 authored by rifkaki's avatar rifkaki

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

parents adf82e09 fadd910f
...@@ -254,6 +254,7 @@ const create = (type = "") => { ...@@ -254,6 +254,7 @@ const create = (type = "") => {
// Monthly // Monthly
const getMonthlyReport = (body) => api.post('transaction/monthly_report/get_all_report', body) const getMonthlyReport = (body) => api.post('transaction/monthly_report/get_all_report', body)
const getMonthlyOI = (body) => api.post('transaction/monthly_report_oi/get_operating_indicator_id', body)
const getMonthlyReportID = (body) => api.post('transaction/monthly_report/get_monthly_report_id', body) const getMonthlyReportID = (body) => api.post('transaction/monthly_report/get_monthly_report_id', body)
const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body) const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body)
const getHierarkiMontlyReportOI = (body) => api.post('transaction/monthly_report_oi/get_report_hierarki', body) const getHierarkiMontlyReportOI = (body) => api.post('transaction/monthly_report_oi/get_report_hierarki', body)
...@@ -530,7 +531,8 @@ const create = (type = "") => { ...@@ -530,7 +531,8 @@ const create = (type = "") => {
getPerBSiMontlyReportLOCF, getPerBSiMontlyReportLOCF,
checkUploadMonthlyReportLOCF, checkUploadMonthlyReportLOCF,
uploadMonthlyReportLOCF, uploadMonthlyReportLOCF,
validateSubmitReportOI validateSubmitReportOI,
getMonthlyOI
} }
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles, createMuiTheme, MuiThemeProvider, Checkbox } from '@material-ui/core';
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images'; import Images from '../assets/Images';
import api from '../api'; import api from '../api';
...@@ -55,7 +55,11 @@ export default class MonthlyReport extends Component { ...@@ -55,7 +55,11 @@ export default class MonthlyReport extends Component {
tipeAlert: '', tipeAlert: '',
messageAlert: '', messageAlert: '',
btnCreate: false, btnCreate: false,
loadview: false loadview: false,
submittedOnly: false,
company_active: null,
company_submit: null,
still_approver: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -102,10 +106,16 @@ export default class MonthlyReport extends Component { ...@@ -102,10 +106,16 @@ export default class MonthlyReport extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () => this.setState({ isApprover: true, checkApprover: true, still_approver: true}, () =>
this.getMonth()) {
if (this.state.submittedOnly) {
this.getMonth()
} else {
this.getCompanyActive()
}
})
} else { } else {
this.setState({ isApprover: false, checkApprover: false }, () => this.setState({ isApprover: false, checkApprover: false, still_approver: false }, () =>
this.getCompanyActive()) this.getCompanyActive())
} }
} else { } else {
...@@ -206,8 +216,9 @@ export default class MonthlyReport extends Component { ...@@ -206,8 +216,9 @@ export default class MonthlyReport extends Component {
options: companyData, options: companyData,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => { this.setState({ listCompany: defaultProps, company: companyData[0], company_active: defaultProps}, () => {
this.getMonth() this.getMonth()
// console.log(this.state.company_active)
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -248,10 +259,14 @@ export default class MonthlyReport extends Component { ...@@ -248,10 +259,14 @@ export default class MonthlyReport extends Component {
console.log(index); console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => { this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => {
if (this.state.isApprover === true) { if (this.state.isApprover === true) {
if (this.state.submittedOnly) {
this.getPeriode() this.getPeriode()
} else { } else {
this.getLastPeriod() this.getLastPeriod()
} }
} else {
this.getLastPeriod()
}
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -313,7 +328,7 @@ export default class MonthlyReport extends Component { ...@@ -313,7 +328,7 @@ export default class MonthlyReport extends Component {
// console.log(periodeData) // console.log(periodeData)
console.log(index) console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) { if (this.state.isApprover === true && this.state.submittedOnly) {
this.getCompanySubmitted() this.getCompanySubmitted()
} else { } else {
this.getRevision() this.getRevision()
...@@ -361,17 +376,20 @@ export default class MonthlyReport extends Component { ...@@ -361,17 +376,20 @@ export default class MonthlyReport extends Component {
if (this.state.rawData !== undefined) { if (this.state.rawData !== undefined) {
indexID = companyData.findIndex((val) => val.company_id == this.state.rawData.company_id) indexID = companyData.findIndex((val) => val.company_id == this.state.rawData.company_id)
} }
// console.log(response.data.data.length)
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => { this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID], company_submit: defaultProps }, () => {
// console.log(response.data.data.length)
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
} else { } else {
// console.log(this.state.listCompany)
// console.log(this.state.company_submit)
this.setState({ listRevision: null, revision: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false }) this.setState({ listRevision: null, revision: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false })
} }
// //
}) })
} else { } else {
this.setState({ listRevision: null, revision: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false, loading: false }, () => { this.setState({ listRevision: null, revision: null, listCompany: null, company: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false, loading: false }, () => {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}) })
} }
...@@ -458,10 +476,9 @@ export default class MonthlyReport extends Component { ...@@ -458,10 +476,9 @@ export default class MonthlyReport extends Component {
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
api.create().checkApproverMonthly().then(response => { api.create().checkApproverMonthly().then(response => {
// // console.log(response);
if (this.state.btnCreate === true && this.state.btnEdit === true) { if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable'); console.log('editable');
this.setState({ isApprover: false, checkApprover: false }) this.setState({ isApprover: this.state.still_approver? true : false, checkApprover: false })
} else { } else {
console.log('just view'); console.log('just view');
this.setState({ isApprover: true, checkApprover: true }) this.setState({ isApprover: true, checkApprover: true })
...@@ -871,6 +888,9 @@ export default class MonthlyReport extends Component { ...@@ -871,6 +888,9 @@ export default class MonthlyReport extends Component {
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.isApprover?
<div className="grid grid-2x" style={{}}>
<div className="col-1" style={{ display: 'flex', maxWidth: '100%', paddingLeft: 0}}>
<Autocomplete <Autocomplete
{...this.state.listMonth} {...this.state.listMonth}
id="month" id="month"
...@@ -887,7 +907,6 @@ export default class MonthlyReport extends Component { ...@@ -887,7 +907,6 @@ export default class MonthlyReport extends Component {
renderInput={(params) => <TextField {...params} label="Month" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Month" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month} value={this.state.month}
/> />
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
...@@ -904,6 +923,73 @@ export default class MonthlyReport extends Component { ...@@ -904,6 +923,73 @@ export default class MonthlyReport extends Component {
renderInput={(params) => <TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode} value={this.state.periode}
/> />
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', alignSelf: 'flex-end'}}>
<FormControlLabel
style={{ margin: 0 }}
value={this.state.submittedOnly}
control={
<Checkbox
checked={this.state.submittedOnly}
onClick={() => this.setState({submittedOnly: !this.state.submittedOnly, loading: true}, () => {
this.getChecApprover()
// console.log(this.state.company)
// this.setState({listCompany: this.state.submittedOnly? this.state.company_submit : this.state.company_active, company: this.state.listCompany != null? this.state.listCompany.options[0] : null})
// console.log(this.state.company_active)
// console.log(this.state.company_submit)
// console.log(this.state.company)
// console.log(this.state.submittedOnly)
// if (this.state.submittedOnly) {
// this.getCompanySubmitted()
// } else {
// this.getCompanyActive()
// }
})} />
}
/>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold', marginLeft: 5, alignSelf: 'center'}}>Submitted Only</Typography>
</div>
</div>
:
<div style={{ display: 'flex' }}>
<Autocomplete
{...this.state.listMonth}
id="month"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.setState({ visibleTableHistory: false })
this.getRevision()
}
})}
disableClearable
style={{ width: 250, marginRight: 20 }}
renderInput={(params) => <TextField {...params} label="Month" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/>
<Autocomplete
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.setState({ visibleTableHistory: false })
this.getRevision()
}
})}
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode}
/>
</div>
}
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
......
...@@ -1198,7 +1198,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1198,7 +1198,7 @@ export default class ListOfCreditFacilities extends Component {
// console.log(totalLoan); // console.log(totalLoan);
// dataTable: newData, totalOutStand: newData[newData.length-1][22] // dataTable: newData, totalOutStand: newData[newData.length-1][22]
if (bankNameEmpty) { if (bankNameEmpty) {
this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS), saveDraft: false }) this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS), saveDraft: true, saveComp: true})
} else { } else {
this.setState({ loading: false, dataTable: newData, totalOutStand: totalLoan, diff: Number(totalLoan - this.state.perBS), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true }) this.setState({ loading: false, dataTable: newData, totalOutStand: totalLoan, diff: Number(totalLoan - this.state.perBS), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true })
} }
...@@ -3490,7 +3490,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3490,7 +3490,7 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleLOCFMR ? {this.state.visibleLOCFMR ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Snackbar open={this.state.snekbar} autoHideDuration={6000} onClose={handleClose}> <Snackbar open={this.state.snekbar} autoHideDuration={3000} onClose={handleClose}>
<Alert onClose={handleClose} severity="error"> <Alert onClose={handleClose} severity="error">
{this.state.snekbarMsg} {this.state.snekbarMsg}
</Alert> </Alert>
...@@ -3507,7 +3507,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3507,7 +3507,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{(this.state.get_for == 'edit' && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && ( {(this.state.get_for == 'edit' &&
<div> <div>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
...@@ -3525,7 +3525,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3525,7 +3525,7 @@ export default class ListOfCreditFacilities extends Component {
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div> </div>
)} )}
{(this.state.get_for == 'edit' && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && ( {(this.state.get_for == 'edit' &&
<div> <div>
<a data-tip={'Upload'} data-for="upload"> <a data-tip={'Upload'} data-for="upload">
<button <button
...@@ -3670,7 +3670,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3670,7 +3670,8 @@ export default class ListOfCreditFacilities extends Component {
type="button" type="button"
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
null : this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
:
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => { setTimeout(() => {
...@@ -3680,7 +3681,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3680,7 +3681,7 @@ export default class ListOfCreditFacilities extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -3699,7 +3700,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3699,7 +3700,7 @@ export default class ListOfCreditFacilities extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.saveComp ? this.state.saveComp ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
...@@ -3710,7 +3711,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3710,7 +3711,7 @@ export default class ListOfCreditFacilities extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveComp === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
...@@ -3824,7 +3825,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3824,7 +3825,8 @@ export default class ListOfCreditFacilities extends Component {
type="button" type="button"
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
null : this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
:
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => { setTimeout(() => {
...@@ -3834,7 +3836,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3834,7 +3836,7 @@ export default class ListOfCreditFacilities extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -3855,7 +3857,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3855,7 +3857,7 @@ export default class ListOfCreditFacilities extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.saveComp ? this.state.saveComp ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({snekbar: true, snekbarMsg: 'Data Incomplete !'})
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
...@@ -3866,7 +3868,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3866,7 +3868,7 @@ export default class ListOfCreditFacilities extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveComp === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
......
...@@ -63,6 +63,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -63,6 +63,7 @@ export default class OperatingIndicatorMR extends Component {
editable: true, editable: true,
emptyData: false, emptyData: false,
templateNull: true, templateNull: true,
judulColumn: null,
get_for: 'view' get_for: 'view'
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -83,7 +84,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -83,7 +84,7 @@ export default class OperatingIndicatorMR extends Component {
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDMonthly,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
...@@ -147,12 +148,14 @@ export default class OperatingIndicatorMR extends Component { ...@@ -147,12 +148,14 @@ export default class OperatingIndicatorMR extends Component {
} }
getOperatingIDMonthly() { getOperatingIDMonthly() {
// console.log(this.props.data.operatingIndID);
let payload = { let payload = {
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode.periode, "periode": this.props.data.periode,
"months": this.props.data.report_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 : null "months": this.props.data.report_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 : null
} }
api.create().getOpetratingIndID(payload).then(response => { api.create().getMonthlyOI(payload).then(response => {
console.log(response);
if (response) { if (response) {
if (response.data.data) { if (response.data.data) {
this.setState({ operatingIndIDMonthly: response.data.data.operating_indicator_id } , () => { this.setState({ operatingIndIDMonthly: response.data.data.operating_indicator_id } , () => {
...@@ -177,12 +180,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -177,12 +180,13 @@ export default class OperatingIndicatorMR extends Component {
"months": this.props.data.report_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 : null, "months": this.props.data.report_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 : null,
"get_for": this.state.get_for "get_for": this.state.get_for
} }
console.log(payload);
api.create().getHierarkiMontlyReportOI(payload).then(response => { api.create().getHierarkiMontlyReportOI(payload).then(response => {
console.log(response); console.log(response);
// console.log(JSON.stringify(response));
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
console.log(res);
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
...@@ -195,13 +199,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -195,13 +199,13 @@ export default class OperatingIndicatorMR extends Component {
item.description, item.description,
item.uom === "" ? null : item.uom, item.uom === "" ? null : item.uom,
item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook, item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.master_budget, item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_budget, item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
item.monthly_report.actual === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.actual, item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_mb, item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_mb, item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.percent_act_vs_mb === "" ? "0.0" : item.monthly_report.percent_act_vs_mb,
item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_rb, item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.amount_act_vs_rb === "" ? "0.0" : item.monthly_report.amount_act_vs_rb,
item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_rb, item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.percent_act_vs_rb === "" ? "0.0" : item.monthly_report.percent_act_vs_rb,
item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb, item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb,
item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb, item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb,
item.order, item.order,
...@@ -225,13 +229,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -225,13 +229,13 @@ export default class OperatingIndicatorMR extends Component {
item.description, item.description,
item.uom === "" ? null : item.uom, item.uom === "" ? null : item.uom,
item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook, item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.master_budget, item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_budget, item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
item.monthly_report.actual === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.actual, item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_mb, item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_mb, item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.percent_act_vs_mb === "" ? "0.0" : item.monthly_report.percent_act_vs_mb,
item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_rb, item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.amount_act_vs_rb === "" ? "0.0" : item.monthly_report.amount_act_vs_rb,
item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_rb, item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.percent_act_vs_rb === "" ? "0.0" : item.monthly_report.percent_act_vs_rb,
item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb, item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb,
item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb, item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb,
item.order, item.order,
...@@ -305,7 +309,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -305,7 +309,7 @@ export default class OperatingIndicatorMR extends Component {
}) })
}) })
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDMonthly,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
...@@ -353,7 +357,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -353,7 +357,7 @@ export default class OperatingIndicatorMR extends Component {
monthly_report: payload monthly_report: payload
} }
console.log(body) console.log(body)
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
} }
}); });
} }
...@@ -424,15 +428,15 @@ export default class OperatingIndicatorMR extends Component { ...@@ -424,15 +428,15 @@ export default class OperatingIndicatorMR extends Component {
}) })
let body = { let body = {
company_id: this.props.data.company.company_id, company_id: this.props.data.company.company_id,
operating_indicator_id: this.props.data.operatingIndID, operating_indicator_id: this.state.operatingIndIDMonthly,
periode: this.props.data.periode, periode: this.props.data.periode,
report_id: this.props.data.report_id, report_id: this.props.data.report_id,
status: type, status: type,
months: this.props.data.report_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 : null, months: this.props.data.report_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 : null,
monthly_report: data monthly_report: data
} }
console.log(data); // console.log(body);
// // console.log(JSON.stringify(body)) // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMonthlyReportOI(body).then(response => { api.create('UPLOAD').uploadMonthlyReportOI(body).then(response => {
// // console.log(response); // // console.log(response);
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -481,7 +485,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -481,7 +485,7 @@ export default class OperatingIndicatorMR extends Component {
// console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDMonthly,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
...@@ -1374,6 +1378,11 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1374,6 +1378,11 @@ export default class OperatingIndicatorMR extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report Submission</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report Submission</Typography>
</div> </div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleOI === true ? {this.state.visibleOI === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
...@@ -1463,7 +1472,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1463,7 +1472,7 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notesUpdate}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notesUpdate}</Typography>
</div> </div>
<div className="grid grid-2x"> <div className="grid grid-2x">
<div className="col-1"> <div className="col-1" style={{ paddingLeft: 20 }}>
<button <button
className="button" className="button"
type="button" type="button"
...@@ -1484,7 +1493,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1484,7 +1493,7 @@ export default class OperatingIndicatorMR extends Component {
</div> </div>
</button> </button>
</div> </div>
{!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}>
{this.state.get_for == 'view' && <button {this.state.get_for == 'view' && <button
type="button" type="button"
onClick={() => { onClick={() => {
...@@ -1492,7 +1501,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1492,7 +1501,7 @@ export default class OperatingIndicatorMR extends Component {
this.handleGetFor('edit') this.handleGetFor('edit')
}) })
}} }}
style={{ marginRight: 20 }} style={{ marginRight: 21 }}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
...@@ -1517,15 +1526,19 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1517,15 +1526,19 @@ export default class OperatingIndicatorMR extends Component {
{this.state.get_for == 'edit' && <button {this.state.get_for == 'edit' && <button
className="button" className="button"
type="button" type="button"
disabled={this.state.editable} // disabled={this.state.editable}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.setState({ loading: true }, () => { onClick={() =>
this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.createData("draft") this.createData("draft")
}, 100); }, 100);
...@@ -1543,15 +1556,19 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1543,15 +1556,19 @@ export default class OperatingIndicatorMR extends Component {
</button>} </button>}
{this.state.get_for == 'edit' && <button {this.state.get_for == 'edit' && <button
type="button" type="button"
disabled={this.state.editable} // disabled={this.state.editable}
onClick={() => this.setState({ loading: true }, () => { onClick={() =>
this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.createData("submitted") this.createData("submitted")
}, 100); }, 100);
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -1649,12 +1666,12 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1649,12 +1666,12 @@ export default class OperatingIndicatorMR extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
disabled={this.state.editable} // disabled={this.state.editable}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ loading: true }, () => { null : this.setState({ loading: true }, () => {
...@@ -1677,16 +1694,17 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1677,16 +1694,17 @@ export default class OperatingIndicatorMR extends Component {
type="button" type="button"
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadOI("submitted") this.uploadOI("submitted")
}, 100); }, 100);
})} })}
disabled={this.state.editable} // disabled={this.state.editable}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
......
...@@ -561,7 +561,7 @@ export default class ProfitLossMR extends Component { ...@@ -561,7 +561,7 @@ export default class ProfitLossMR extends Component {
let err = false let err = false
this.state.dataTable.map((i, index) => { this.state.dataTable.map((i, index) => {
if(i[0] === 3 && i[4] === 2) { if(i[0] === 3 && i[4] === 2) {
console.log(i); // console.log(i);
if ( i[19] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) { if ( i[19] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
console.log('msk 1'); console.log('msk 1');
// console.log(i); // console.log(i);
...@@ -608,8 +608,8 @@ export default class ProfitLossMR extends Component { ...@@ -608,8 +608,8 @@ export default class ProfitLossMR extends Component {
} }
// 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.data.data.result) // console.log(response.data.data.result)
console.log(err); // console.log(err);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if (response.data.data.result && err === false) { if (response.data.data.result && err === false) {
......
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