Commit df9374a9 authored by rifkaki's avatar rifkaki

handle close

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