Commit bc515672 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

+++

See merge request !391
parents bc7aa7ec a41156ea
...@@ -202,6 +202,7 @@ const create = (type = "") => { ...@@ -202,6 +202,7 @@ const create = (type = "") => {
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 checkIsSubmit = (body) => api.post('transaction/master_budget/is_can_submit', body)
const checkApprover = () => api.get('transaction/master_budget/is_approver') const checkApprover = () => api.get('transaction/master_budget/is_approver')
const approvalSubmission = (body) => api.post('transaction/master_budget/approval_submission', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
...@@ -363,7 +364,8 @@ const create = (type = "") => { ...@@ -363,7 +364,8 @@ const create = (type = "") => {
getIdDeleteFromExcel, getIdDeleteFromExcel,
getDashboard, getDashboard,
historyApproval, historyApproval,
checkApprover checkApprover,
approvalSubmission
} }
} }
......
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 BalanceSheet from './BudgetTahunan/BalanceSheet'; import BalanceSheet from './BudgetTahunan/BalanceSheet';
...@@ -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 { DatePicker } from '@material-ui/pickers';
var ct = require("../library/CustomTable"); var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -52,7 +53,8 @@ export default class BudgetTahunan extends Component { ...@@ -52,7 +53,8 @@ export default class BudgetTahunan extends Component {
isSubmit: false, isSubmit: false,
visibleTableHistory: false, visibleTableHistory: false,
isApprover: false, isApprover: false,
lastStatus: "" lastStatus: "",
intent: ""
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -60,10 +62,14 @@ export default class BudgetTahunan extends Component { ...@@ -60,10 +62,14 @@ export default class BudgetTahunan extends Component {
componentDidMount() { componentDidMount() {
this.props.selectIndex('Master Budget & CAT') this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) { if (this.props.location.state !== undefined) {
this.setState({ userType: this.props.location.state.userType }) console.log(this.props);
} this.setState({ userType: this.props.location.state.userType, intent: 'Home', rawData: this.props.location.state.rawData }, () => {
this.checkApprover()
})
} else {
this.checkApprover() this.checkApprover()
} }
}
checkApprover() { checkApprover() {
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
...@@ -115,8 +121,15 @@ export default class BudgetTahunan extends Component { ...@@ -115,8 +121,15 @@ export default class BudgetTahunan extends Component {
item.revision item.revision
] ]
}) })
let dataTableRevision = response.data.data.map((item, index) => {
return [
"",
item.report_name,
""
]
})
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable, loading: false }) this.setState({ dataTable, loading: false, dataTableRevision })
} }
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -144,6 +157,7 @@ export default class BudgetTahunan extends Component { ...@@ -144,6 +157,7 @@ export default class BudgetTahunan extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let comID = this.state.rawData ? this.state.rawData.company_id : 0
let companyData = data.map((item) => { let companyData = data.map((item) => {
return { return {
company_id: item.company_id, company_id: item.company_id,
...@@ -163,8 +177,8 @@ export default class BudgetTahunan extends Component { ...@@ -163,8 +177,8 @@ export default class BudgetTahunan extends Component {
options: arrayBaru, options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
let index = arrayBaru.findIndex((val) => val.company_id == comID)
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => { this.setState({ listCompany: defaultProps, company: index == -1 ? arrayBaru[0] : arrayBaru[index] }, () => {
this.getPeriode() this.getPeriode()
}) })
} else { } else {
...@@ -186,7 +200,7 @@ export default class BudgetTahunan extends Component { ...@@ -186,7 +200,7 @@ export default class BudgetTahunan extends Component {
getPeriode() { getPeriode() {
api.create().getPeriodeTransaction().then(response => { api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date let dateNow = new Date
let year = format(dateNow, 'yyyy') let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let data = response.data.data let data = response.data.data
...@@ -251,6 +265,7 @@ export default class BudgetTahunan extends Component { ...@@ -251,6 +265,7 @@ export default class BudgetTahunan extends Component {
submissionID: response.data.data.submission_id, isSubmit: false, submissionID: response.data.data.submission_id, isSubmit: false,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status
}, () => { }, () => {
this.setState({ loading: false })
this.checkIsSubmit() this.checkIsSubmit()
this.historyApproval() this.historyApproval()
}) })
...@@ -297,6 +312,21 @@ export default class BudgetTahunan extends Component { ...@@ -297,6 +312,21 @@ export default class BudgetTahunan extends Component {
// }) // })
} }
approvalSubmission(type) {
let body = {
"approval_id": this.state.rawData.approval_id,
"status": type,
"remarks": "tes",
"detail": [
{
"report_id": 1,
"remarks": ""
}
]
}
api.create().ApprovalSubmission(body)
}
clickDetail(item, id, revision, status) { clickDetail(item, id, revision, status) {
console.log(item); console.log(item);
this.setState({ this.setState({
...@@ -427,7 +457,6 @@ export default class BudgetTahunan extends Component { ...@@ -427,7 +457,6 @@ export default class BudgetTahunan extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getCompanyActive() this.getCompanyActive()
this.setState({ loading: false })
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -441,7 +470,7 @@ export default class BudgetTahunan extends Component { ...@@ -441,7 +470,7 @@ export default class BudgetTahunan extends Component {
let array = [] let array = []
let canSubmit = true let canSubmit = true
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[1] !== 'Cash Flow') { if (item[1] !== 'Cash Flow' && item[1] !== 'CAT' && item[1] !== 'Tax Planning') {
if (item[3] !== "submitted") { if (item[3] !== "submitted") {
canSubmit = false canSubmit = false
array.push(item[3]) array.push(item[3])
...@@ -462,6 +491,7 @@ export default class BudgetTahunan extends Component { ...@@ -462,6 +491,7 @@ export default class BudgetTahunan extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "Success") { if (response.data.status === "Success") {
this.getCompanyActive() this.getCompanyActive()
this.setState({ loading: true })
} }
} }
}) })
...@@ -571,6 +601,33 @@ export default class BudgetTahunan extends Component { ...@@ -571,6 +601,33 @@ export default class BudgetTahunan extends Component {
const columnsHistory = [ const columnsHistory = [
"Name", "Status", "Remarks", "Revision Item", "Date" "Name", "Status", "Remarks", "Revision Item", "Date"
] ]
const columnRevisi = [
{
name: "#",
options: {
customBodyRender: (val, tableMeta, updateValue) => {
var list = [];
for (var i = 0; i <= tableMeta.rowData[6]; i++) {
list.push(i);
}
return (
<div style={{ display: 'flex' }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<Checkbox
/>
}
/>
</div >
);
}
}
}, "Report Type", "Remarks"
]
const options = { const options = {
filter: false, filter: false,
sort: false, sort: false,
...@@ -583,6 +640,17 @@ export default class BudgetTahunan extends Component { ...@@ -583,6 +640,17 @@ export default class BudgetTahunan extends Component {
rowsPerPageOptions: [5, 25, 100], rowsPerPageOptions: [5, 25, 100],
search: false search: false
} }
const optionsRevision = {
filter: false,
sort: false,
responsive: "scroll",
print: false,
download: false,
selectableRows: false,
viewColumns: false,
pagination: false,
search: false
}
const loadingComponent = ( const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}> <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader <PropagateLoader
...@@ -617,12 +685,13 @@ export default class BudgetTahunan extends Component { ...@@ -617,12 +685,13 @@ export default class BudgetTahunan extends Component {
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false, loading: true })
this.getRevision() this.getRevision()
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
this.getSubmission() this.getSubmission()
})} })}
disabled={this.state.intent === 'Home' ? true : false}
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => renderInput={(params) =>
...@@ -635,8 +704,9 @@ export default class BudgetTahunan extends Component { ...@@ -635,8 +704,9 @@ export default class BudgetTahunan extends Component {
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
id="company" id="company"
disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false, loading: true })
this.getRevision() this.getRevision()
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
...@@ -771,7 +841,7 @@ export default class BudgetTahunan extends Component { ...@@ -771,7 +841,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => null} onClick={() => this.setState({ visibleRevision: true })}
> >
<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' }}>Review</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
...@@ -897,6 +967,7 @@ export default class BudgetTahunan extends Component { ...@@ -897,6 +967,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)} saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)} getReport={this.getCompanyActive.bind(this)}
isApprover={this.state.isApprover}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
...@@ -913,6 +984,7 @@ export default class BudgetTahunan extends Component { ...@@ -913,6 +984,7 @@ export default class BudgetTahunan extends Component {
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} status={this.state.status}
isApprover={this.state.isApprover}
/> />
)} )}
...@@ -978,6 +1050,119 @@ export default class BudgetTahunan extends Component { ...@@ -978,6 +1050,119 @@ export default class BudgetTahunan extends Component {
getReport={this.getCompanyActive.bind(this)} getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
{this.state.visibleRevision && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Revision</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleRevision: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div className="border-bottom" style={{ padding: 20 }}>
<span>Anda meminta anak perusahaan untuk melakukan revisi.</span>
<div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTableRevision}
columns={columnRevisi}
options={optionsRevision}
/>
</MuiThemeProvider>
</div>
<div style={{ marginTop: 20 }}>
<span>Durasi waktu yang anda berikan untuk revisi: </span>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 20 }}>
<div>
<DatePicker
margin="normal"
id="startDate"
label="Valid From"
format="dd-MM-yyyy"
onChange={(e) => null}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
<span style={{ alignSelf: 'center' }}>Sampai dengan</span>
<div>
<DatePicker
margin="normal"
id="startDate"
label="Valid To"
format="dd-MM-yyyy"
onChange={(e) => null}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
</div>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => null}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
</div>
</button>
</div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => null}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Revision</span>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div > </div >
); );
} }
......
...@@ -227,6 +227,7 @@ export default class BalanceSheet extends Component { ...@@ -227,6 +227,7 @@ export default class BalanceSheet extends Component {
"balance_sheet": data "balance_sheet": data
} }
// console.log(data); // console.log(data);
this.setState({ loading: false })
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -658,6 +659,7 @@ export default class BalanceSheet extends Component { ...@@ -658,6 +659,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -744,6 +746,7 @@ export default class BalanceSheet extends Component { ...@@ -744,6 +746,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -831,6 +834,7 @@ export default class BalanceSheet extends Component { ...@@ -831,6 +834,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -918,6 +922,7 @@ export default class BalanceSheet extends Component { ...@@ -918,6 +922,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1005,6 +1010,7 @@ export default class BalanceSheet extends Component { ...@@ -1005,6 +1010,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1092,6 +1098,7 @@ export default class BalanceSheet extends Component { ...@@ -1092,6 +1098,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1179,6 +1186,7 @@ export default class BalanceSheet extends Component { ...@@ -1179,6 +1186,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1266,6 +1274,7 @@ export default class BalanceSheet extends Component { ...@@ -1266,6 +1274,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1353,6 +1362,7 @@ export default class BalanceSheet extends Component { ...@@ -1353,6 +1362,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1440,6 +1450,7 @@ export default class BalanceSheet extends Component { ...@@ -1440,6 +1450,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1527,6 +1538,7 @@ export default class BalanceSheet extends Component { ...@@ -1527,6 +1538,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1614,6 +1626,7 @@ export default class BalanceSheet extends Component { ...@@ -1614,6 +1626,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1701,6 +1714,7 @@ export default class BalanceSheet extends Component { ...@@ -1701,6 +1714,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1788,6 +1802,7 @@ export default class BalanceSheet extends Component { ...@@ -1788,6 +1802,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1875,6 +1890,7 @@ export default class BalanceSheet extends Component { ...@@ -1875,6 +1890,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1989,6 +2005,7 @@ export default class BalanceSheet extends Component { ...@@ -1989,6 +2005,7 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
{this.props.isApprover == true ? null :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
...@@ -2038,6 +2055,7 @@ export default class BalanceSheet extends Component { ...@@ -2038,6 +2055,7 @@ export default class BalanceSheet extends Component {
</a> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> </div>
}
</div> </div>
</div> </div>
...@@ -2074,6 +2092,7 @@ export default class BalanceSheet extends Component { ...@@ -2074,6 +2092,7 @@ export default class BalanceSheet extends Component {
</div> </div>
</button> </button>
</div> </div>
{this.props.isApprover === true ? null :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
className="button" className="button"
...@@ -2102,7 +2121,7 @@ export default class BalanceSheet extends Component { ...@@ -2102,7 +2121,7 @@ export default class BalanceSheet extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.editable === true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -2113,11 +2132,7 @@ export default class BalanceSheet extends Component { ...@@ -2113,11 +2132,7 @@ export default class BalanceSheet extends Component {
this.backToMasterBudget('draft') this.backToMasterBudget('draft')
}, 100); }, 100);
}) : }) :
this.setState({ loading: true }, () => { null}
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
> >
<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' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
...@@ -2133,7 +2148,9 @@ export default class BalanceSheet extends Component { ...@@ -2133,7 +2148,9 @@ export default class BalanceSheet extends Component {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
}, 100); }, 100);
}) })
: this.backToMasterBudget('submitted') : this.setState({ loading: true }, () => {
this.backToMasterBudget('submitted')
})
}} }}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2147,6 +2164,7 @@ export default class BalanceSheet extends Component { ...@@ -2147,6 +2164,7 @@ export default class BalanceSheet extends Component {
</div> </div>
</button> </button>
</div> </div>
}
</div> </div>
</Paper> </Paper>
: :
......
...@@ -521,64 +521,6 @@ export default class ProfitLoss extends Component { ...@@ -521,64 +521,6 @@ export default class ProfitLoss extends Component {
return a return a
} }
const handleFormula = (data, tableMeta, month) => { const handleFormula = (data, tableMeta, month) => {
let rilFormula = String(tableMeta.rowData[3])
if (rilFormula.includes('#')) {
if (this.props.status === "not-yet") {
let splitOrder = String(tableMeta.rowData[3]).split('@')
for (let index = 0; index < splitOrder.length; index++) {
if (splitOrder[index] === "") {
} else {
if (splitOrder[index].includes('#')) {
} else {
let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let reg = /^\d+$/
splitOperator.map((item) => {
if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item)
if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
}
}
})
}
}
}
let body = {
"submission_id": null,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
console.log(response);
// if (response.data) {
// if (response.data.status === "success") {
// return response.data.data.result
// }
// }
})
} else {
let body = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
return response.data.data.result
}
}
})
}
} else {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
...@@ -620,49 +562,6 @@ export default class ProfitLoss extends Component { ...@@ -620,49 +562,6 @@ export default class ProfitLoss extends Component {
}) })
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a return a
}
// console.log(rilFormula);
// let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
// let arrayJumlah = []
// arrayFormula.map((item, indexs) => {
// let index = dataTable2.findIndex((val) => val[1] == item)
// if (index > 0) {
// arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
// } else {
// arrayJumlah.push(item)
// }
// // if (indexs % 2 !== 0) {
// // operator.push(item)
// // }
// })
// let array = arrayJumlah
// let total = 0
// let opt = ""
// array.map((item, index) => {
// if (item == "+") {
// opt = "tambah"
// } else if (item == "-") {
// opt = "kurang"
// } else if (item == "*") {
// opt = "kali"
// } else if (item == "/") {
// opt = "bagi"
// } else {
// if (opt == "tambah") {
// total = Number(total) + Number(item)
// } else if (opt == "kurang") {
// total = Number(total) - Number(item)
// } else if (opt == "kali") {
// total = Number(total) * Number(item)
// } else if (opt == "bagi") {
// total = Number(total) / Number(item)
// } else {
// total += item
// }
// }
// })
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
// return a
} }
......
...@@ -24,7 +24,7 @@ class HomePage extends Component { ...@@ -24,7 +24,7 @@ class HomePage extends Component {
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({userData: response.data.data}, () => { this.setState({ userData: response.data.data }, () => {
console.log(this.state.userData) console.log(this.state.userData)
}) })
} }
...@@ -33,7 +33,7 @@ class HomePage extends Component { ...@@ -33,7 +33,7 @@ class HomePage extends Component {
this.getDashboard() this.getDashboard()
} }
componentDidUpdate(){ componentDidUpdate() {
window.onpopstate = e => { window.onpopstate = e => {
//your code... //your code...
this.props.selectIndex('Home') this.props.selectIndex('Home')
...@@ -43,12 +43,13 @@ class HomePage extends Component { ...@@ -43,12 +43,13 @@ class HomePage extends Component {
getDashboard() { getDashboard() {
let listDashboard = [] let listDashboard = []
api.create().getDashboard().then((response) => { api.create().getDashboard().then((response) => {
console.log(response);
if (String(response.data.status).toLocaleLowerCase() == 'success') { if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data let data = response.data.data
data.map((item,index) => { data.map((item, index) => {
listDashboard.push([index+1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status]) listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status])
}) })
this.setState({listDashboard}) this.setState({ listDashboard, rawData: response.data.data })
} }
}) })
} }
...@@ -58,9 +59,16 @@ class HomePage extends Component { ...@@ -58,9 +59,16 @@ class HomePage extends Component {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
// console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Link to={{pathname: `/home/master-budget/`, state: {userType: 'approver'}}}> <Link to={{
pathname: `/home/master-budget/`,
state: {
userType: 'approver',
rawData: this.state.rawData[tableMeta.rowIndex]
}
}}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -126,7 +134,7 @@ class HomePage extends Component { ...@@ -126,7 +134,7 @@ class HomePage extends Component {
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<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: '24px', color: 'white' }}>{this.state.userData === null? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography> <Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null ? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography>
</div> </div>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
...@@ -138,7 +146,7 @@ class HomePage extends Component { ...@@ -138,7 +146,7 @@ class HomePage extends Component {
<div> <div>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={data} data={this.state.listDashboard}
columns={columns} columns={columns}
options={options} options={options}
/> />
......
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