Commit 8c6e3f42 authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

permission

See merge request !759
parents b356415d 760e55ed
...@@ -67,7 +67,9 @@ export default class BudgetTahunan extends Component { ...@@ -67,7 +67,9 @@ export default class BudgetTahunan extends Component {
minDateRevision: new Date(), minDateRevision: new Date(),
maxDateRevision: new Date(), maxDateRevision: new Date(),
btnApprove: false, btnApprove: false,
isAdmin: false isAdmin: false,
btncreate: false,
loadview: false
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -84,9 +86,11 @@ export default class BudgetTahunan extends Component { ...@@ -84,9 +86,11 @@ export default class BudgetTahunan extends Component {
// // console.log(this.props); // // console.log(this.props);
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => { this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => {
this.checkApprover() this.checkApprover()
this.getPermission()
}) })
} else { } else {
this.checkApprover() this.checkApprover()
this.getPermission()
} }
} }
...@@ -152,6 +156,34 @@ export default class BudgetTahunan extends Component { ...@@ -152,6 +156,34 @@ export default class BudgetTahunan extends Component {
}) })
} }
getPermission() {
let payload = {
menu: "master budget & cat"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btncreate: response.data.data.create,
loadview: response.data.data.view
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
getCompanySubmitted() { getCompanySubmitted() {
let body = { let body = {
"periode": this.state.periode.periode "periode": this.state.periode.periode
...@@ -1489,6 +1521,8 @@ export default class BudgetTahunan extends Component { ...@@ -1489,6 +1521,8 @@ export default class BudgetTahunan extends Component {
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
btncreate={this.state.btncreate}
loadview={this.state.loadview}
/> />
) )
} }
......
...@@ -54,12 +54,43 @@ export default class MonthlyReport extends Component { ...@@ -54,12 +54,43 @@ export default class MonthlyReport extends Component {
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '', messageAlert: '',
btncreate: false,
loadview: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
getPermission() {
let payload = {
menu: "monthly report"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btncreate: response.data.data.create,
loadview: response.data.data.view
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
componentDidMount() { componentDidMount() {
this.getChecApprover() this.getChecApprover()
this.getPermission()
this.setState({ loading: true }) this.setState({ loading: true })
// this.getCompanyActive() // this.getCompanyActive()
} }
...@@ -70,13 +101,13 @@ export default class MonthlyReport extends Component { ...@@ -70,13 +101,13 @@ export default class MonthlyReport extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
// console.log(response); // console.log(response);
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.getPeriode())
} else { // } else {
this.setState({ isApprover: false, checkApprover: false }, () => this.setState({ isApprover: false, checkApprover: false }, () =>
this.getCompanyActive()) this.getCompanyActive())
} // }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -1108,6 +1139,8 @@ export default class MonthlyReport extends Component { ...@@ -1108,6 +1139,8 @@ 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({ visibleTP: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleTP: false, visibleMonthlyReport: true })}
btncreate={this.state.btncreate}
loadview={this.state.loadview}
// getReport={this.getCompanyActive.bind(this)} // getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
......
...@@ -62,6 +62,7 @@ export default class TaxPlanningMR extends Component { ...@@ -62,6 +62,7 @@ export default class TaxPlanningMR extends Component {
this.getSettingControl() this.getSettingControl()
// this.getItemHierarki() // this.getItemHierarki()
// this.getLatestUpdate() // this.getLatestUpdate()
console.log(this.props.loadview)
} }
getSettingControl() { getSettingControl() {
...@@ -1112,7 +1113,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1112,7 +1113,7 @@ export default class TaxPlanningMR extends Component {
} }
} }
}, { }, {
name: `Trial Balance (Fiscal) Actual MTD`, name: `Trial Balance (Fiscal) Actual YTD`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} > <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
...@@ -1243,7 +1244,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1243,7 +1244,7 @@ export default class TaxPlanningMR extends Component {
} }
} }
}, { }, {
name: `Trial Balance (Fiscal) MB MTD`, name: `Trial Balance (Fiscal) MB YTD`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} > <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
...@@ -1455,6 +1456,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1455,6 +1456,7 @@ export default class TaxPlanningMR extends Component {
: */} : */}
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{/* {((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')) && ( */}
{this.props.btncreate === true &&
<div> <div>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
...@@ -1471,8 +1473,10 @@ export default class TaxPlanningMR extends Component { ...@@ -1471,8 +1473,10 @@ export default class TaxPlanningMR extends Component {
</a> </a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div> </div>
}
{/* )} */} {/* )} */}
{/* {((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')) && ( */}
{this.props.btncreate === true &&
<div> <div>
<a data-tip={'Upload'} data-for="upload"> <a data-tip={'Upload'} data-for="upload">
<button <button
...@@ -1491,27 +1495,32 @@ export default class TaxPlanningMR extends Component { ...@@ -1491,27 +1495,32 @@ export default class TaxPlanningMR extends Component {
</a> </a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div> </div>
}
{/* )} */} {/* )} */}
<a data-tip={'Download'} data-for="download"> {(this.props.loadview === true || this.props.btncreate === true) && (
<button <div>
style={{ <a data-tip={'Download'} data-for="download">
backgroundColor: 'transparent', <button
cursor: 'pointer', style={{
borderColor: 'transparent', backgroundColor: 'transparent',
margin: 5 cursor: 'pointer',
}} borderColor: 'transparent',
onClick={() => margin: 5
this.setState({ loading: true }, () => { }}
setTimeout(() => { onClick={() =>
this.downloadAllData() this.setState({ loading: true }, () => {
}, 100); setTimeout(() => {
}) this.downloadAllData()
} }, 100);
> })
<img src={Images.download} /> }
</button> >
</a> <img src={Images.download} />
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
)}
</div> </div>
{/* } */} {/* } */}
</div> </div>
...@@ -1553,6 +1562,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1553,6 +1562,7 @@ export default class TaxPlanningMR extends Component {
</div> </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') ? */}
{this.props.btncreate === true &&
<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"
...@@ -1630,6 +1640,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1630,6 +1640,7 @@ export default class TaxPlanningMR extends Component {
</div> </div>
</button> </button>
</div> </div>
}
{/* : null } */} {/* : null } */}
</div> </div>
</Paper> </Paper>
......
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