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 {
if (response.data.status === "success") {
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () =>
this.getPeriode())
this.getMonth())
} else {
this.setState({ isApprover: false, checkApprover: false }, () =>
this.getCompanyActive())
......@@ -247,7 +247,11 @@ export default class MonthlyReport extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month)
console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => {
this.getLastPeriod()
if (this.state.isApprover === true) {
this.getPeriode()
} else {
this.getLastPeriod()
}
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -302,7 +306,7 @@ export default class MonthlyReport extends Component {
options: periodeData,
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)
// console.log(data)
console.log(this.state.lastPeriod)
......@@ -333,10 +337,11 @@ export default class MonthlyReport extends Component {
getCompanySubmitted() {
let body = {
"periode": this.state.periode.periode
"periode": this.state.periode.periode,
"months": this.state.month.month_id,
}
api.create().getCompanySubmittedMonthly(body).then(response => {
// // console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
if (response.data.data.length > 0) {
......@@ -358,7 +363,6 @@ export default class MonthlyReport extends Component {
}
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// // console.log(response.data.data);
if (response.data.data.length > 0) {
this.getRevision()
} else {
......@@ -871,7 +875,12 @@ export default class MonthlyReport extends Component {
{...this.state.listMonth}
id="month"
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
style={{ width: 250, marginRight: 20 }}
......@@ -883,7 +892,12 @@ export default class MonthlyReport extends Component {
{...this.state.listPeriode}
id="periode"
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
style={{ width: 250 }}
......@@ -895,7 +909,8 @@ export default class MonthlyReport extends Component {
<Autocomplete
{...this.state.listCompany}
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()
})}
disableClearable
......@@ -1124,6 +1139,7 @@ export default class MonthlyReport extends Component {
month={this.state.month}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })}
isApprover={this.state.isApprover}
// getReport={this.getCompanyActive.bind(this)}
/>
......
......@@ -164,7 +164,7 @@ export default class CashFlowMR extends Component {
let tst = String(item).replace('[M-1]', '[M1]')
let data = 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)
if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value
......
......@@ -912,10 +912,10 @@ export default class ProfitLossMR extends Component {
control={
<NumberFormat
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"
placeholder=""
disabled={false}
disabled={this.props.isApprover}
value={Number(tableMeta.rowData[10]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1686,55 +1686,78 @@ export default class ProfitLossMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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>
{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' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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>
</div>
......@@ -1749,30 +1772,35 @@ export default class ProfitLossMR extends Component {
</MuiThemeProvider>
)}
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
{/* {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') ? */}
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
</div>
{/* {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') ? */}
<div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{this.props.isApprover === true ?
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
......@@ -1843,10 +1871,10 @@ export default class ProfitLossMR extends Component {
</div>
</button>
</div>
</div>
}
</div>
{/* : null
} */}
</div>
</Paper>
:
<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