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'
import Constant from '../library/Constant'
// our "constructor"
const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => {
const create = (type = "") => {
let api;
// ------
// STEP 1
// ------
//
// Create and configure an apisauce-based api object.
//
const 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',
},
// 10 second timeout...
timeout: 30000
})
const baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/'
switch (type) {
case '':
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',
},
// 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 () => {
var token
......@@ -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 getSubmission = (body) => api.post('transaction/get_submission_id', 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
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/') =>
deleteDocument,
createSubmitReport,
getSubmission,
checkUploadMB
checkUploadMB,
uploadMasterBudget
}
}
......
......@@ -653,6 +653,8 @@ export default class BudgetTahunan extends Component {
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
getReport={this.getReport.bind(this)}
getReportAttachment={this.getReportAttachment.bind(this)}
/>
)}
{this.state.visiblePL && (
......
......@@ -714,11 +714,6 @@ export default class BalanceSheet extends Component {
} else {
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) {
......@@ -880,12 +875,37 @@ export default class BalanceSheet extends Component {
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() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => {
......@@ -957,6 +977,7 @@ export default class BalanceSheet extends Component {
return a
}
const columns = [{
name: "",
options: {
......@@ -1000,11 +1021,13 @@ export default class BalanceSheet extends Component {
tableMeta.rowData[4] == 0 ?
<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>
{this.checkError(tableMeta)}
</a>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
{this.checkError(tableMeta)}
</a>
</div>
:
......@@ -2551,10 +2574,10 @@ export default class BalanceSheet extends Component {
cursor: this.state.disabledSave === true ? 'default' : 'pointer',
borderColor: 'transparent',
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>
</div>
</button>
......@@ -2609,14 +2632,18 @@ export default class BalanceSheet extends Component {
onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())}
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>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError == true ? true : false}
onClick={() => null}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadBalanceSheet()
}, 100);
})}
style={{ marginRight: 20 }}
>
<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 {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
this.setState({ loading: false })
}, 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 {
setting: payload
}
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';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet';
import api from '../api';
import Autocomplete from '@material-ui/lab/Autocomplete';
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 UploadFile from "../library/Upload";
import { format } from 'date-fns';
......@@ -207,40 +202,41 @@ export default class OperatingIndicator extends Component {
render() {
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",
options: {
customBodyRender: (val, tableMeta) => {
......@@ -377,7 +373,7 @@ export default class OperatingIndicator extends Component {
value={this.state.company}
/>
</div>
<div style={{ marginTop: 20 }}>
{/* <div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listRevision}
id="revision"
......@@ -391,7 +387,7 @@ export default class OperatingIndicator extends Component {
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.revision}
/>
</div>
</div> */}
<div style={{ marginTop: 20 }}>
<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