Commit d0f7c5d8 authored by faisalhamdi's avatar faisalhamdi

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

parents bfccd74d 7e6decdd
...@@ -103,7 +103,7 @@ export default class MonthlyReport extends Component { ...@@ -103,7 +103,7 @@ export default class MonthlyReport extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () => this.setState({ isApprover: true, checkApprover: true }, () =>
this.getPeriode()) this.getMonth())
} else { } else {
this.setState({ isApprover: false, checkApprover: false }, () => this.setState({ isApprover: false, checkApprover: false }, () =>
this.getCompanyActive()) this.getCompanyActive())
...@@ -247,7 +247,11 @@ export default class MonthlyReport extends Component { ...@@ -247,7 +247,11 @@ export default class MonthlyReport extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month) let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month)
console.log(index); console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => { this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => {
if (this.state.isApprover === true) {
this.getPeriode()
} else {
this.getLastPeriod() this.getLastPeriod()
}
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -302,7 +306,7 @@ export default class MonthlyReport extends Component { ...@@ -302,7 +306,7 @@ export default class MonthlyReport extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod === undefined ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// console.log(data) // console.log(data)
console.log(this.state.lastPeriod) console.log(this.state.lastPeriod)
...@@ -333,10 +337,11 @@ export default class MonthlyReport extends Component { ...@@ -333,10 +337,11 @@ export default class MonthlyReport extends Component {
getCompanySubmitted() { getCompanySubmitted() {
let body = { let body = {
"periode": this.state.periode.periode "periode": this.state.periode.periode,
"months": this.state.month.month_id,
} }
api.create().getCompanySubmittedMonthly(body).then(response => { api.create().getCompanySubmittedMonthly(body).then(response => {
// // console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
...@@ -358,7 +363,6 @@ export default class MonthlyReport extends Component { ...@@ -358,7 +363,6 @@ export default class MonthlyReport extends Component {
} }
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => { this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// // console.log(response.data.data);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
} else { } else {
...@@ -871,7 +875,12 @@ export default class MonthlyReport extends Component { ...@@ -871,7 +875,12 @@ export default class MonthlyReport extends Component {
{...this.state.listMonth} {...this.state.listMonth}
id="month" id="month"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true }, () => { onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true }, () => {
this.getMonthlyReportID() if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.setState({ visibleTableHistory: false })
this.getRevision()
}
})} })}
disableClearable disableClearable
style={{ width: 250, marginRight: 20 }} style={{ width: 250, marginRight: 20 }}
...@@ -883,7 +892,12 @@ export default class MonthlyReport extends Component { ...@@ -883,7 +892,12 @@ export default class MonthlyReport extends Component {
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true }, () => {
this.getMonthlyReportID() if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.setState({ visibleTableHistory: false })
this.getRevision()
}
})} })}
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
...@@ -895,7 +909,8 @@ export default class MonthlyReport extends Component { ...@@ -895,7 +909,8 @@ export default class MonthlyReport extends Component {
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
id="company" id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue, loading: true }, () => { disabled={this.state.listCompany === null ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getMonthlyReportID() this.getMonthlyReportID()
})} })}
disableClearable disableClearable
...@@ -1124,6 +1139,7 @@ export default class MonthlyReport extends Component { ...@@ -1124,6 +1139,7 @@ export default class MonthlyReport extends Component {
month={this.state.month} month={this.state.month}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
// getReport={this.getCompanyActive.bind(this)} // getReport={this.getCompanyActive.bind(this)}
/> />
......
...@@ -164,7 +164,7 @@ export default class CashFlowMR extends Component { ...@@ -164,7 +164,7 @@ export default class CashFlowMR extends Component {
let tst = String(item).replace('[M-1]', '[M1]') let tst = String(item).replace('[M-1]', '[M1]')
let data = tableMeta.columnIndex let data = tableMeta.columnIndex
// console.log(tableMeta.columnIndex) // console.log(tableMeta.columnIndex)
let indexID = tableMeta.rowData[data].actual_formula.findIndex((val) => val.item_formula == String(`@${tst}`)) let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`))
// console.log(indexID) // console.log(indexID)
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value let valuezz = tableMeta.rowData[data].formula[indexID].value
......
...@@ -912,10 +912,10 @@ export default class ProfitLossMR extends Component { ...@@ -912,10 +912,10 @@ export default class ProfitLossMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.props.isApprover ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.props.isApprover}
value={Number(tableMeta.rowData[10]).toFixed(1)} value={Number(tableMeta.rowData[10]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1686,6 +1686,28 @@ export default class ProfitLossMR extends Component { ...@@ -1686,6 +1686,28 @@ export default class ProfitLossMR 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 ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<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
...@@ -1735,6 +1757,7 @@ export default class ProfitLossMR extends Component { ...@@ -1735,6 +1757,7 @@ export default class ProfitLossMR 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>
...@@ -1749,10 +1772,12 @@ export default class ProfitLossMR extends Component { ...@@ -1749,10 +1772,12 @@ export default class ProfitLossMR extends Component {
</MuiThemeProvider> </MuiThemeProvider>
)} )}
</div> </div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null : {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */} (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1"> <div className="col-1">
<button <button
type="button" type="button"
...@@ -1773,6 +1798,9 @@ export default class ProfitLossMR extends Component { ...@@ -1773,6 +1798,9 @@ export default class ProfitLossMR extends Component {
</div> </div>
</button> </button>
</div> </div>
{this.props.isApprover === true ?
<div className="col-2">
</div> :
<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"
...@@ -1843,10 +1871,10 @@ export default class ProfitLossMR extends Component { ...@@ -1843,10 +1871,10 @@ export default class ProfitLossMR extends Component {
</div> </div>
</button> </button>
</div> </div>
}
</div> </div>
{/* : null {/* : null
} */} } */}
</div>
</Paper> </Paper>
: :
<Paper style={{ paddingTop: 10 }}> <Paper style={{ paddingTop: 10 }}>
......
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