Commit e9266c57 authored by Riri Novita's avatar Riri Novita

viewOnly

parent 5ba24ef4
...@@ -54,6 +54,7 @@ export default class BalanceSheetMR extends Component { ...@@ -54,6 +54,7 @@ export default class BalanceSheetMR extends Component {
notes: "", notes: "",
judulColumn: null, judulColumn: null,
get_for: "view", get_for: "view",
viewOnly : true,
kansas: 0 kansas: 0
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -62,6 +63,36 @@ export default class BalanceSheetMR extends Component { ...@@ -62,6 +63,36 @@ export default class BalanceSheetMR extends Component {
componentDidMount() { componentDidMount() {
this.getSettingControl() this.getSettingControl()
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})
} }
getLatestUpdate() { getLatestUpdate() {
...@@ -2598,7 +2629,7 @@ export default class BalanceSheetMR extends Component { ...@@ -2598,7 +2629,7 @@ export default class BalanceSheetMR extends Component {
<div className="col-2"> <div className="col-2">
</div> : </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={{
......
...@@ -65,6 +65,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -65,6 +65,7 @@ export default class OperatingIndicatorMR extends Component {
templateNull: true, templateNull: true,
judulColumn: null, judulColumn: null,
saveDraft: true, saveDraft: true,
viewOnly : true,
get_for: 'view' get_for: 'view'
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -73,9 +74,39 @@ export default class OperatingIndicatorMR extends Component { ...@@ -73,9 +74,39 @@ export default class OperatingIndicatorMR extends Component {
componentDidMount() { componentDidMount() {
// this.getItemHierarki() // this.getItemHierarki()
this.getSettingControl() this.getSettingControl()
this.handleViewOnly()
// this.getLatestUpdate() // this.getLatestUpdate()
} }
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) {
this.setState({get_for: type}, () => { this.setState({get_for: type}, () => {
this.getSettingControl() this.getSettingControl()
...@@ -1678,7 +1709,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1678,7 +1709,7 @@ export default class OperatingIndicatorMR extends Component {
</button> </button>
</div> </div>
{!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}> {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}>
{this.state.get_for == 'view' && <button {this.state.get_for == 'view' && this.state.viewOnly && <button
type="button" type="button"
onClick={() => { onClick={() => {
this.setState({loading: true}, () => { this.setState({loading: true}, () => {
......
...@@ -92,6 +92,7 @@ export default class ProfitLossMR extends Component { ...@@ -92,6 +92,7 @@ export default class ProfitLossMR extends Component {
handleTekTekTek: 0, handleTekTekTek: 0,
saveDraft: true, saveDraft: true,
buttonError: true, buttonError: true,
viewOnly : true,
get_for: 'view' get_for: 'view'
} }
...@@ -102,6 +103,36 @@ export default class ProfitLossMR extends Component { ...@@ -102,6 +103,36 @@ export default class ProfitLossMR extends Component {
// this.getItemHierarki() // this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
this.getSettingControl() this.getSettingControl()
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) {
...@@ -2118,7 +2149,7 @@ export default class ProfitLossMR extends Component { ...@@ -2118,7 +2149,7 @@ export default class ProfitLossMR extends Component {
<div className="col-2"> <div className="col-2">
</div> : </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={{
......
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