Commit 6fe8586b 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 de54a1ba 5340be35
...@@ -38,7 +38,7 @@ const create = (type = "") => { ...@@ -38,7 +38,7 @@ const create = (type = "") => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
// 40 second timeout... // 40 second timeout...
timeout: 40000 timeout: 50000
}) })
break; break;
default: default:
...@@ -202,6 +202,9 @@ const create = (type = "") => { ...@@ -202,6 +202,9 @@ const create = (type = "") => {
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body) const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_operating_indicator_report_hierarki', body) const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_operating_indicator_report_hierarki', body)
const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_submission_report', body) const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_submission_report', body)
const checkUploadOperatingInd = (body) => api.post('transaction/operating_indicator/check_import', body)
const uploadOperatingInd = (body) => api.post('transaction/operating_indicator/import_operating_indicator', 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}`)
...@@ -343,7 +346,9 @@ const create = (type = "") => { ...@@ -343,7 +346,9 @@ const create = (type = "") => {
getOpetratingIndID, getOpetratingIndID,
createAllItemReport, createAllItemReport,
deleteAllItemReport, deleteAllItemReport,
validateSubmitReport validateSubmitReport,
checkUploadOperatingInd,
uploadOperatingInd
} }
} }
......
...@@ -352,6 +352,7 @@ export default class ProfitLoss extends Component { ...@@ -352,6 +352,7 @@ export default class ProfitLoss extends Component {
}) })
}) })
let body = { let body = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
...@@ -370,6 +371,9 @@ export default class ProfitLoss extends Component { ...@@ -370,6 +371,9 @@ export default class ProfitLoss extends Component {
} }
} else { } else {
alert(response.problem) alert(response.problem)
this.setState({loading: false})
this.props.onClickClose()
this.props.getReport()
} }
}) })
} }
...@@ -406,16 +410,21 @@ export default class ProfitLoss extends Component { ...@@ -406,16 +410,21 @@ export default class ProfitLoss extends Component {
// } else { // } else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// } // }
let total = 0
dataTable2[tableMeta.rowIndex].map((item,index) => {
if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == ""? 0 : item
total += Number(valItem)
}
})
dataTable2[tableMeta.rowIndex][20] = total
} }
} }
const handleTotal = (tableMeta) => {
let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 7 && index <= 18) {
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
}
})
dataTable2[tableMeta.rowIndex][19] = total
return total
// console.log(total);
}
const handleNotes = (value, tableMeta) => { const handleNotes = (value, tableMeta) => {
console.log(value) console.log(value)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
...@@ -557,14 +566,14 @@ export default class ProfitLoss extends Component { ...@@ -557,14 +566,14 @@ export default class ProfitLoss extends Component {
{tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null : {tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} // value={value}
control={ control={
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleNotes(event.target.value, tableMeta) handleNotes(event.target.value, tableMeta)
...@@ -1692,29 +1701,9 @@ export default class ProfitLoss extends Component { ...@@ -1692,29 +1701,9 @@ export default class ProfitLoss extends Component {
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ width: 96, textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div style={{ flex: 1 }}> null : tableMeta.rowData[0] === 2 ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -1724,48 +1713,17 @@ export default class ProfitLoss extends Component { ...@@ -1724,48 +1713,17 @@ export default class ProfitLoss extends Component {
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span> :
: <span style={{ fontSize: 12, textAlign: 'right' }}>
tableMeta.rowData[0] === 4 ? <NumberFormat
null thousandSeparator={true}
: style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
tableMeta.rowData[0] === 6 ? type="text"
// <NumberFormat placeholder=""
// thousandSeparator={true} disabled={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} value={handleTotal(tableMeta)}
// type="text" />
// placeholder="" </span>}
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
:
tableMeta.rowData[0] === 1 ?
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
null
}
</div> </div>
) )
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, createMuiTheme, MuiThemeProvider } 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 OperatingIndicatorDetail from './OperatingIndicatorDetail' import OperatingIndicatorDetail from './OperatingIndicatorDetail'
...@@ -10,6 +10,9 @@ import { ExcelRenderer } from 'react-excel-renderer'; ...@@ -10,6 +10,9 @@ 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';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
export default class OperatingIndicator extends Component { export default class OperatingIndicator extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -121,7 +124,7 @@ export default class OperatingIndicator extends Component { ...@@ -121,7 +124,7 @@ export default class OperatingIndicator extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val == year) let index = data.sort((a, b) => a - b).findIndex((val) => val == year)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
this.getReport() this.getReport()
this.getSubmission() this.getOperatingID()
}) })
} }
} }
...@@ -156,7 +159,7 @@ export default class OperatingIndicator extends Component { ...@@ -156,7 +159,7 @@ export default class OperatingIndicator extends Component {
}) })
} }
getSubmission() { getOperatingID() {
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode "periode": this.state.periode.periode
...@@ -353,7 +356,7 @@ export default class OperatingIndicator extends Component { ...@@ -353,7 +356,7 @@ export default class OperatingIndicator extends Component {
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.getReport() this.getReport()
this.getSubmission() this.getOperatingID()
// this.getReportAttachment() // this.getReportAttachment()
})} })}
debug debug
...@@ -369,7 +372,7 @@ export default class OperatingIndicator extends Component { ...@@ -369,7 +372,7 @@ export default class OperatingIndicator extends Component {
id="company" id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getReport() this.getReport()
this.getSubmission() this.getOperatingID()
// this.getReportAttachment() // this.getReportAttachment()
})} })}
debug debug
...@@ -379,72 +382,15 @@ export default class OperatingIndicator extends Component { ...@@ -379,72 +382,15 @@ export default class OperatingIndicator extends Component {
value={this.state.company} value={this.state.company}
/> />
</div> </div>
{/* <div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listRevision}
id="revision"
onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => {
this.getReport()
this.getReportAttachment()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.revision}
/>
</div> */}
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<MUIDataTable <MuiThemeProvider theme={getMuiTheme()}>
data={this.state.dataTable} <MUIDataTable
columns={columns} data={this.state.dataTable}
options={options} columns={columns}
open={this.props.open} options={options}
height={this.props.height} />
width={this.props.width} </MuiThemeProvider>
/>
</div>
{/* <div style={{ display: 'flex', marginTop: 20 }}>
<div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div>
<div style={{ width: '50%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography>
</button>
</div>
</div> </div>
<div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>{item.attachment_name}</Typography>
)
})
: null
}
</div>
<div style={{ width: '50%' }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
)
})
: null
}
</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' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
...@@ -459,6 +405,7 @@ export default class OperatingIndicator extends Component { ...@@ -459,6 +405,7 @@ export default class OperatingIndicator extends Component {
{this.state.visibleDetailOpt && {this.state.visibleDetailOpt &&
<OperatingIndicatorDetail <OperatingIndicatorDetail
open={this.props.open}
data={this.state.dataDetail} data={this.state.dataDetail}
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
......
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