Commit ca322812 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

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

parents 6ba78d5f 64b7c62d
...@@ -199,6 +199,7 @@ const create = (type = "") => { ...@@ -199,6 +199,7 @@ const create = (type = "") => {
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body) const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
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 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)
...@@ -352,7 +353,8 @@ const create = (type = "") => { ...@@ -352,7 +353,8 @@ const create = (type = "") => {
checkUploadOperatingInd, checkUploadOperatingInd,
uploadOperatingInd, uploadOperatingInd,
getLastestUpdateMB, getLastestUpdateMB,
countingFormula countingFormula,
submitMasterBudget
} }
} }
......
...@@ -17,6 +17,7 @@ import { format } from 'date-fns'; ...@@ -17,6 +17,7 @@ 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());
...@@ -54,7 +55,7 @@ export default class BudgetTahunan extends Component { ...@@ -54,7 +55,7 @@ export default class BudgetTahunan extends Component {
} }
componentDidMount() { componentDidMount() {
this.getCompanyActive() this.getDetailUser()
} }
getReportAttachment() { getReportAttachment() {
...@@ -103,6 +104,21 @@ export default class BudgetTahunan extends Component { ...@@ -103,6 +104,21 @@ export default class BudgetTahunan extends Component {
}) })
} }
getDetailUser() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company}, () => {
this.getCompanyActive()
})
}
}
}
})
}
getCompanyActive() { getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { api.create().getPerusahaanActive().then((response) => {
if (response.data) { if (response.data) {
...@@ -114,11 +130,21 @@ export default class BudgetTahunan extends Component { ...@@ -114,11 +130,21 @@ export default class BudgetTahunan extends Component {
company_name: item.company_name, company_name: item.company_name,
} }
}) })
let arrayBaru = []
this.state.userCompany.map((item,index) => {
let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) {
arrayBaru.push(companyData[indexID])
}
})
let defaultProps = { let defaultProps = {
options: companyData, options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => {
this.getPeriode() this.getPeriode()
}) })
} else { } else {
...@@ -134,7 +160,6 @@ export default class BudgetTahunan extends Component { ...@@ -134,7 +160,6 @@ export default class BudgetTahunan extends Component {
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
} }
}) })
} }
...@@ -265,7 +290,7 @@ export default class BudgetTahunan extends Component { ...@@ -265,7 +290,7 @@ export default class BudgetTahunan extends Component {
visibleTP: false, visibleTP: false,
visibleCF: false, visibleCF: false,
}) })
} else if (item === "Cash Flow"){ } else if (item === "Cash Flow") {
this.setState({ this.setState({
visibleBudgetTahunan: false, visibleBudgetTahunan: false,
visibleBS: false, visibleBS: false,
...@@ -348,6 +373,21 @@ export default class BudgetTahunan extends Component { ...@@ -348,6 +373,21 @@ export default class BudgetTahunan extends Component {
}) })
} }
validate() {
let array = []
this.state.dataTable.map(item => {
if (item[3].includes("not-yet") || item[3].includes("draft")) {
array.push(item[3])
} else {
array.push(item[3])
}
})
if (array.includes("not-yet" || "draft")) {
console.log('gagal');
} else {
console.log('masuk');
}
}
render() { render() {
const columns = ["#", "Report Type", const columns = ["#", "Report Type",
...@@ -582,9 +622,19 @@ export default class BudgetTahunan extends Component { ...@@ -582,9 +622,19 @@ export default class BudgetTahunan extends Component {
</div> </div>
</div> </div>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <button
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography> style={{
</div> backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
>
<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>
</div>
</button>
</div> </div>
</Paper> </Paper>
...@@ -654,7 +704,6 @@ export default class BudgetTahunan extends Component { ...@@ -654,7 +704,6 @@ 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}
/> />
)} )}
......
This diff is collapsed.
...@@ -2,7 +2,6 @@ import React, { Component } from 'react'; ...@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } 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 BalanceSheet from './BudgetTahunan/BalanceSheet';
import api from '../api'; import api from '../api';
import Autocomplete from '@material-ui/lab/Autocomplete'; import Autocomplete from '@material-ui/lab/Autocomplete';
import { titleCase } from '../library/Utils'; import { titleCase } from '../library/Utils';
...@@ -13,6 +12,7 @@ import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget'; ...@@ -13,6 +12,7 @@ import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../library/Upload"; import UploadFile from "../library/Upload";
import { format } from 'date-fns'; import { format } from 'date-fns';
import BalanceSheetMR from './MonthlyReport/BalanceSheetMR';
export default class MonthlyReport extends Component { export default class MonthlyReport extends Component {
constructor(props) { constructor(props) {
...@@ -161,54 +161,59 @@ export default class MonthlyReport extends Component { ...@@ -161,54 +161,59 @@ export default class MonthlyReport extends Component {
}) })
} }
clickDetail(item, id) { clickDetail(item, id, revision, status) {
this.setState({ report_id: id }) this.setState({
if (item === 'Balance Sheet') { report_id: id,
this.setState({ revisionTable: revision,
visibleMonthlyReport: false, status: status
visibleBS: true, }, () => {
visiblePL: false, if (item === 'Balance Sheet') {
visibleCAT: false, this.setState({
visibleFAM: false, visibleMonthlyReport: false,
visibleTP: false, visibleBS: true,
}) visiblePL: false,
} else if (item === 'Profit & Loss') { visibleCAT: false,
this.setState({ visibleFAM: false,
visibleMonthlyReport: false, visibleTP: false,
visibleBS: false, })
visiblePL: true, } else if (item === 'Profit & Loss') {
visibleCAT: false, this.setState({
visibleFAM: false, visibleMonthlyReport: false,
visibleTP: false visibleBS: false,
}) visiblePL: true,
} else if (item === 'Tax Planning') { visibleCAT: false,
this.setState({ visibleFAM: false,
visibleMonthlyReport: false, visibleTP: false
visibleBS: false, })
visiblePL: false, } else if (item === 'Tax Planning') {
visibleCAT: false, this.setState({
visibleFAM: false, visibleMonthlyReport: false,
visibleTP: true visibleBS: false,
}) visiblePL: false,
} else if (item === 'Fixed Assets Movement') { visibleCAT: false,
this.setState({ visibleFAM: false,
visibleMonthlyReport: false, visibleTP: true
visibleBS: false, })
visiblePL: false, } else if (item === 'Fixed Assets Movement') {
visibleCAT: false, this.setState({
visibleFAM: true, visibleMonthlyReport: false,
visibleTP: false visibleBS: false,
}) visiblePL: false,
} else if (item === 'CAT') { visibleCAT: false,
this.setState({ visibleFAM: true,
visibleMonthlyReport: false, visibleTP: false
visibleBS: false, })
visiblePL: false, } else if (item === 'CAT') {
visibleCAT: true, this.setState({
visibleFAM: false, visibleMonthlyReport: false,
visibleTP: false visibleBS: false,
}) visiblePL: false,
} visibleCAT: true,
visibleFAM: false,
visibleTP: false
})
}
})
} }
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
...@@ -291,9 +296,9 @@ export default class MonthlyReport extends Component { ...@@ -291,9 +296,9 @@ export default class MonthlyReport extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{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 === "revision" ? val === "revision" ?
<span>Revisi</span> : <span>Revisi</span> :
null null
} }
</div > </div >
); );
...@@ -312,9 +317,9 @@ export default class MonthlyReport extends Component { ...@@ -312,9 +317,9 @@ export default class MonthlyReport extends Component {
cursor: tableMeta.rowData[5] ? 'pointer' : null, cursor: tableMeta.rowData[5] ? 'pointer' : null,
borderColor: 'transparent' borderColor: 'transparent'
}} }}
// onClick={() => onClick={() =>
// tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4]) : 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>
</button> </button>
...@@ -530,10 +535,18 @@ export default class MonthlyReport extends Component { ...@@ -530,10 +535,18 @@ export default class MonthlyReport extends Component {
)} )}
{this.state.visibleBS && ( {this.state.visibleBS && (
<BalanceSheet <BalanceSheetMR
open={this.props.open}
report_id={this.state.report_id} report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company} company={this.state.company}
onClickClose={() => this.setState({ visibleBS: false, visibleMonthlyReport: true })} revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
// saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
// getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
......
This diff is collapsed.
...@@ -9,6 +9,7 @@ import { titleCase } from '../../library/Utils'; ...@@ -9,6 +9,7 @@ import { titleCase } from '../../library/Utils';
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { format } from 'date-fns'; import { format } from 'date-fns';
import Constant from '../../library/Constant';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -35,7 +36,7 @@ export default class OperatingIndicator extends Component { ...@@ -35,7 +36,7 @@ export default class OperatingIndicator extends Component {
} }
componentDidMount() { componentDidMount() {
this.getCompanyActive() this.getDetailUser()
} }
getReportAttachment() { getReportAttachment() {
...@@ -82,25 +83,61 @@ export default class OperatingIndicator extends Component { ...@@ -82,25 +83,61 @@ export default class OperatingIndicator extends Component {
}) })
} }
getDetailUser() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company}, () => {
this.getCompanyActive()
})
}
}
}
})
}
getCompanyActive() { getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { api.create().getPerusahaanActive().then((response) => {
if (response.data.status === 'success') { if (response.data) {
let data = response.data.data if (response.data.status === 'success') {
let companyData = data.map((item) => { let data = response.data.data
return { let companyData = data.map((item) => {
company_id: item.company_id, return {
company_name: item.company_name, company_id: item.company_id,
} company_name: item.company_name,
}) }
let defaultProps = { })
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name), let arrayBaru = []
}; this.state.userCompany.map((item,index) => {
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => { let indexID = companyData.findIndex((val) => val.company_id == item)
this.getPeriode() if (indexID !== -1) {
}) arrayBaru.push(companyData[indexID])
}
})
let defaultProps = {
options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => {
this.getPeriode()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
} }
}) })
} }
...@@ -378,7 +415,13 @@ export default class OperatingIndicator extends Component { ...@@ -378,7 +415,13 @@ export default class OperatingIndicator extends Component {
debug debug
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) =>
<TextField
{...params}
label="Company"
margin="normal"
style={{ marginTop: 7 }}
/>}
value={this.state.company} value={this.state.company}
/> />
</div> </div>
......
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