Commit 7991b197 authored by Deni Rinaldi's avatar Deni Rinaldi

cek

parent a695d679
......@@ -200,6 +200,7 @@ const create = (type = "") => {
const getMonthTransaction = () => api.get('transaction/get_default_month')
const countingFormula = (body) => api.post('transaction/counting_formula', body)
const submitMasterBudget = (body) => api.post('transaction/master_budget/submit_master_budget', body)
const checkIsSubmit = (body) => api.post('transaction/master_budget/is_can_submit', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
......@@ -354,7 +355,8 @@ const create = (type = "") => {
uploadOperatingInd,
getLastestUpdateMB,
countingFormula,
submitMasterBudget
submitMasterBudget,
checkIsSubmit
}
}
......
......@@ -17,7 +17,6 @@ import { format } from 'date-fns';
import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader"
import CashFlow from './BudgetTahunan/CashFlow';
import { validate } from '@material-ui/pickers';
var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -49,7 +48,8 @@ export default class BudgetTahunan extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
submissionID: null
submissionID: null,
isSubmit: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -119,7 +119,7 @@ export default class BudgetTahunan extends Component {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.setState({ listCompany: defaultProps, company: companyData[0], isSubmit: false }, () => {
this.getPeriode()
})
} else {
......@@ -199,9 +199,12 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode
}
api.create().getSubmission(payload).then(response => {
console.log(response)
if (response) {
if (response.data.data) {
this.setState({ submissionID: response.data.data.submission_id })
this.setState({ submissionID: response.data.data.submission_id }, () => {
this.checkIsSubmit()
})
} else {
this.setState({ submissionID: null })
}
......@@ -209,6 +212,19 @@ export default class BudgetTahunan extends Component {
})
}
checkIsSubmit() {
let body = {
"submission_id": this.state.submissionID
}
api.create().checkIsSubmit(body).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({ isSubmit: true })
}
}
})
}
clickDetail(item, id, revision, status) {
console.log(item);
this.setState({
......@@ -358,11 +374,17 @@ export default class BudgetTahunan extends Component {
array.push(item[3])
}
})
if (array.includes("not-yet" || "draft")) {
console.log('gagal');
} else {
console.log('masuk');
// if (array.includes("not-yet" || "draft")) {
// console.log('gagal');
// } else {
// console.log('masuk');
// }
let body = {
submission_id: this.state.submissionID
}
api.create().submitMasterBudget(body).then(response => {
console.log(response);
})
}
render() {
......@@ -409,10 +431,14 @@ export default class BudgetTahunan extends Component {
{val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
val === "draft" ?
<img src={Images.cross} style={{ width: 31, height: 24 }} /> :
<span>Draft</span> :
val === "revision" ?
<span>Revisi</span> :
null
val === "approval_proccess" ?
<span>Approval Proccess</span> :
val === "not-yet" ?
null :
<img src={Images.cross} style={{ width: 31, height: 24 }} />
}
</div >
);
......@@ -432,7 +458,9 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent'
}}
onClick={() =>
tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) : null
// tableMeta.rowData[5] ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null
}
>
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
......@@ -601,11 +629,11 @@ export default class BudgetTahunan extends Component {
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
cursor: this.state.isSubmit ? 'pointer' : 'cursor',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
onClick={() => this.state.isSubmit ? this.validate() : null}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
......@@ -680,6 +708,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
getReport={this.getReport.bind(this)}
status={this.state.status}
/>
)}
......@@ -696,6 +725,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)}
status={this.state.status}
/>
)}
{this.state.visibleFAM && (
......@@ -711,6 +741,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)}
status={this.state.status}
/>
)}
{this.state.visibleCAT && (
......
......@@ -612,7 +612,8 @@ export default class BalanceSheet extends Component {
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null
:
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......
......@@ -181,7 +181,7 @@ export default class Profile extends Component {
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
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