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

cek

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