Commit dbc4d681 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 835a35be cf5ba795
...@@ -3,25 +3,47 @@ import apisauce from 'apisauce' ...@@ -3,25 +3,47 @@ import apisauce from 'apisauce'
import Constant from '../library/Constant' import Constant from '../library/Constant'
// our "constructor" // our "constructor"
const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => { const create = (type = "") => {
let api;
// ------ // ------
// STEP 1 // STEP 1
// ------ // ------
// //
// Create and configure an apisauce-based api object. // Create and configure an apisauce-based api object.
// //
const api = apisauce.create({ const baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/'
// base URL is read from the "constructor" switch (type) {
baseURL, case '':
// here are some default headers api = apisauce.create({
headers: { // base URL is read from the "constructor"
'Cache-Control': 'no-cache', baseURL,
Accept: 'application/json', // here are some default headers
'Content-Type': 'application/json', headers: {
}, 'Cache-Control': 'no-cache',
// 10 second timeout... Accept: 'application/json',
timeout: 30000 'Content-Type': 'application/json',
}) },
// 60 second timeout...
timeout: 30000
})
break;
case 'UPLOAD':
api = apisauce.create({
// base URL is read from the "constructor"
baseURL,
// here are some default headers
headers: {
'Cache-Control': 'no-cache',
Accept: 'application/json',
'Content-Type': 'application/json',
},
// 40 second timeout...
timeout: 40000
})
break;
default:
break;
}
api.addAsyncRequestTransform(request => async () => { api.addAsyncRequestTransform(request => async () => {
var token var token
...@@ -169,6 +191,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -169,6 +191,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const createSubmitReport = (body) => api.post('transaction/master_budget/create_submission_report', body) const createSubmitReport = (body) => api.post('transaction/master_budget/create_submission_report', body)
const getSubmission = (body) => api.post('transaction/get_submission_id', body) const getSubmission = (body) => api.post('transaction/get_submission_id', body)
const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body) const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body)
const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body)
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -299,7 +322,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -299,7 +322,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
deleteDocument, deleteDocument,
createSubmitReport, createSubmitReport,
getSubmission, getSubmission,
checkUploadMB checkUploadMB,
uploadMasterBudget
} }
} }
......
...@@ -653,6 +653,8 @@ export default class BudgetTahunan extends Component { ...@@ -653,6 +653,8 @@ export default class BudgetTahunan extends Component {
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
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.getReport.bind(this)}
getReportAttachment={this.getReportAttachment.bind(this)}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
......
...@@ -714,11 +714,6 @@ export default class BalanceSheet extends Component { ...@@ -714,11 +714,6 @@ export default class BalanceSheet extends Component {
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
// this.forceUpdate()
// console.log(this.state.dataTable)
// this.setState({
// data: a,
// }, () => console.log(this.state.dataTable))
} }
backToMasterBudget(type) { backToMasterBudget(type) {
...@@ -880,12 +875,37 @@ export default class BalanceSheet extends Component { ...@@ -880,12 +875,37 @@ export default class BalanceSheet extends Component {
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false }) this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false })
} }
} }
}) })
} }
checkError(tableMeta) {
if (tableMeta.rowData[22]) {
if (tableMeta.rowData[22][0] === 'item') {
this.setState({ buttonError: true })
}
}
}
uploadBalanceSheet() {
api.create('UPLOAD').uploadMasterBudget(this.state.payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
this.props.getReportAttachment()
} else {
alert(response.data.status)
}
} else {
alert(response.problem)
}
})
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
...@@ -957,6 +977,7 @@ export default class BalanceSheet extends Component { ...@@ -957,6 +977,7 @@ export default class BalanceSheet extends Component {
return a return a
} }
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -1000,11 +1021,13 @@ export default class BalanceSheet extends Component { ...@@ -1000,11 +1021,13 @@ export default class BalanceSheet extends Component {
tableMeta.rowData[4] == 0 ? tableMeta.rowData[4] == 0 ?
<a data-tip={tableMeta.rowData[22][0].message} data-for="account"> <a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
{this.checkError(tableMeta)}
</a> </a>
: :
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<a data-tip={tableMeta.rowData[22][0].message} data-for="account"> <a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
{this.checkError(tableMeta)}
</a> </a>
</div> </div>
: :
...@@ -2551,10 +2574,10 @@ export default class BalanceSheet extends Component { ...@@ -2551,10 +2574,10 @@ export default class BalanceSheet extends Component {
cursor: this.state.disabledSave === true ? 'default' : 'pointer', cursor: this.state.disabledSave === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
> >
<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</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div> </div>
</button> </button>
...@@ -2609,14 +2632,18 @@ export default class BalanceSheet extends Component { ...@@ -2609,14 +2632,18 @@ export default class BalanceSheet extends Component {
onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())} onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<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' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
<button <button
type="button" type="button"
disabled={this.state.buttonError == true ? true : false} disabled={this.state.buttonError == true ? true : false}
onClick={() => null} onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadBalanceSheet()
}, 100);
})}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<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' }}>
...@@ -2635,7 +2662,7 @@ export default class BalanceSheet extends Component { ...@@ -2635,7 +2662,7 @@ export default class BalanceSheet extends Component {
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: false }) this.setState({ loading: false })
}, 100); }, 100);
}) })
}} }}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -301,7 +301,7 @@ export default class Parameter extends Component { ...@@ -301,7 +301,7 @@ export default class Parameter extends Component {
setting: payload setting: payload
} }
console.log(resp.rows[1]); console.log(resp.rows[1]);
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1] === undefined ? "" : resp.rows[1][0] })
} }
}); });
} }
......
...@@ -2,14 +2,9 @@ import React, { Component } from 'react'; ...@@ -2,14 +2,9 @@ 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';
import ProfitLoss from './BudgetTahunan/ProfitLoss';
import TaxPlanning from './BudgetTahunan/TaxPlanning';
import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement';
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';
...@@ -207,40 +202,41 @@ export default class OperatingIndicator extends Component { ...@@ -207,40 +202,41 @@ export default class OperatingIndicator extends Component {
render() { render() {
const columns = ["#", "Jenis Laporan", const columns = ["#", "Jenis Laporan",
// {
// name: "Revision",
// 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={
// <Select
// value={val}
// onChange={event => {
// // console.log(event.target)
// updateValue(event.target.value)
// this.handleChange(event.target.value, tableMeta)
// }}
// autoWidth
// >
// {list.map((item, index) =>
// <MenuItem key={index} value={item}>{item}</MenuItem>
// )}
// </Select>
// }
// />
// </div >
// );
// }
// }
// },
{ {
name: "Revision",
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={
<Select
value={val}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
autoWidth
>
{list.map((item, index) =>
<MenuItem key={index} value={item}>{item}</MenuItem>
)}
</Select>
}
/>
</div >
);
}
}
}, {
name: "Status", name: "Status",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
...@@ -377,7 +373,7 @@ export default class OperatingIndicator extends Component { ...@@ -377,7 +373,7 @@ export default class OperatingIndicator extends Component {
value={this.state.company} value={this.state.company}
/> />
</div> </div>
<div style={{ marginTop: 20 }}> {/* <div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
{...this.state.listRevision} {...this.state.listRevision}
id="revision" id="revision"
...@@ -391,7 +387,7 @@ export default class OperatingIndicator extends Component { ...@@ -391,7 +387,7 @@ export default class OperatingIndicator extends Component {
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.revision} value={this.state.revision}
/> />
</div> </div> */}
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<MUIDataTable <MUIDataTable
......
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