Commit df9374a9 authored by rifkaki's avatar rifkaki

handle close

parent 5ba24ef4
......@@ -48,7 +48,8 @@ export default class FixedAssetsMovementMR extends Component {
visibleFAMMR: true,
updateBy: '-',
notesUpdate: '-',
get_for: 'view'
get_for: 'view',
viewOnly : true
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -56,6 +57,7 @@ export default class FixedAssetsMovementMR extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
this.handleViewOnly()
}
handleGetFor(type) {
......@@ -65,6 +67,35 @@ export default class FixedAssetsMovementMR extends Component {
})
}
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
// else if (this.props.prevRevision) {
// viewOnly = false
// }
if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
checkStatus = true
} else {
checkStatus = false
}
this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus})
}
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
......@@ -1328,7 +1359,7 @@ export default class FixedAssetsMovementMR extends Component {
<div className="col-2"></div>
:
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && <button
{this.state.get_for == 'view' && this.state.viewOnly && <button
className="button"
type="button"
style={{
......
......@@ -54,7 +54,8 @@ export default class TaxPlanningMR extends Component {
handleTekTekTek: 0,
saveDraft: true,
buttonError: true,
get_for: "view"
get_for: "view",
viewOnly : true
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -64,6 +65,36 @@ export default class TaxPlanningMR extends Component {
this.getSettingControl()
// this.getItemHierarki()
this.getLatestUpdate()
this.handleViewOnly()
}
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
// else if (this.props.prevRevision) {
// viewOnly = false
// }
if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
checkStatus = true
} else {
checkStatus = false
}
this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus})
}
handleGetFor(type) {
......@@ -1560,7 +1591,7 @@ export default class TaxPlanningMR extends Component {
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{this.state.get_for == 'view' && <button
{this.state.get_for == 'view' && this.state.viewOnly && <button
className="button"
type="button"
style={{
......
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