Commit e9266c57 authored by Riri Novita's avatar Riri Novita

viewOnly

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