Commit b28f51f7 authored by d.arizona's avatar d.arizona

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into didam

parents d32dd49a 3a2002bb
...@@ -265,8 +265,7 @@ const create = (type = "") => { ...@@ -265,8 +265,7 @@ const create = (type = "") => {
// const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body) // const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/get_report_hierarki', body)
// const getHierarkiMontlyReportFAM = (body) => api.post('transaction/fam/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportFAM = (body) => api.post('transaction/fam/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
const getHierarkiMontlyReportCF = (body) => api.post('transaction/cash_flow/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportCF = (body) => api.post('transaction/cash_flow/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/cat/monthly_report/get_report_hierarki', body) const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/cat/monthly_report/get_report_hierarki', body)
const getLastPeriodMonthly = (idCompany) => api.get(`transaction/monthly_report/get_last_periode/${idCompany}`) const getLastPeriodMonthly = (idCompany) => api.get(`transaction/monthly_report/get_last_periode/${idCompany}`)
...@@ -281,22 +280,19 @@ const create = (type = "") => { ...@@ -281,22 +280,19 @@ const create = (type = "") => {
const createMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/create_monthly_report', body) const createMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/create_monthly_report', body)
// const createMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body) // const createMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const createMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/create_monthly_report', body) const createMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/create_monthly_report', body)
// const createMonthlyReportFAM = (body) => api.post('transaction/fam/monthly_report/create_monthly_report', body) const createMonthlyReportFAM = (body) => api.post('transaction/fam/monthly_report/create_monthly_report', body)
const createMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/create_monthly_report', body)
const createMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/create_monthly_report', body) const createMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/create_monthly_report', body)
const createMonthlyReportCAT = (body) => api.post('transaction/cat/monthly_report/create_monthly_report', body) const createMonthlyReportCAT = (body) => api.post('transaction/cat/monthly_report/create_monthly_report', body)
// const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body) // const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
const checkUploadMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/check_import', body) const checkUploadMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/check_import', body)
// const checkUploadMonthlyReportFAM = (body) => api.post('transaction/fam/monthly_report/check_import', body) const checkUploadMonthlyReportFAM = (body) => api.post('transaction/fam/monthly_report/check_import', body)
const checkUploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/check_import', body)
// const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body) // const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body)
const checkUploadMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/check_import', body) const checkUploadMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/check_import', body)
const checkUploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/check_import', body) const checkUploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/check_import', body)
const checkUploadMonthlyReportCAT = (body) => api.post('transaction/cat/monthly_report/check_import', body) const checkUploadMonthlyReportCAT = (body) => api.post('transaction/cat/monthly_report/check_import', body)
// const uploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/import_monthly_report', body) // const uploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/import_monthly_report', body)
const uploadMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/import_monthly_report', body) const uploadMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/import_monthly_report', body)
// const uploadMonthlyReportFAM = (body) => api.post('transaction/fam/monthly_report/import_monthly_report', body) const uploadMonthlyReportFAM = (body) => api.post('transaction/fam/monthly_report/import_monthly_report', body)
const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body)
// const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body) // const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/import_monthly_report', body) const uploadMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body) const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
......
...@@ -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={{
......
...@@ -1801,14 +1801,14 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1801,14 +1801,14 @@ export default class CorporateAnnualTargetMR extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -1825,7 +1825,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1825,7 +1825,7 @@ export default class CorporateAnnualTargetMR extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -1833,7 +1833,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1833,7 +1833,7 @@ export default class CorporateAnnualTargetMR extends Component {
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
...@@ -1943,14 +1943,14 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1943,14 +1943,14 @@ export default class CorporateAnnualTargetMR extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -1967,7 +1967,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1967,7 +1967,7 @@ export default class CorporateAnnualTargetMR extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -1975,7 +1975,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1975,7 +1975,7 @@ export default class CorporateAnnualTargetMR extends Component {
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
......
...@@ -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={{
...@@ -1375,14 +1406,14 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1375,14 +1406,14 @@ export default class FixedAssetsMovementMR extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -1396,10 +1427,10 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1396,10 +1427,10 @@ export default class FixedAssetsMovementMR extends Component {
</button>} </button>}
{this.state.get_for == 'edit' && <button {this.state.get_for == 'edit' && <button
type="button" type="button"
disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -1407,7 +1438,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1407,7 +1438,7 @@ export default class FixedAssetsMovementMR extends Component {
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
...@@ -1493,14 +1524,14 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1493,14 +1524,14 @@ export default class FixedAssetsMovementMR extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
...@@ -1517,7 +1548,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1517,7 +1548,7 @@ export default class FixedAssetsMovementMR extends Component {
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
...@@ -1525,7 +1556,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1525,7 +1556,7 @@ export default class FixedAssetsMovementMR extends Component {
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
......
...@@ -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={{
......
...@@ -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={{
...@@ -1610,17 +1641,18 @@ export default class TaxPlanningMR extends Component { ...@@ -1610,17 +1641,18 @@ export default class TaxPlanningMR extends Component {
type="button" type="button"
onClick={() => onClick={() =>
this.state.saveDraft === true ? this.state.saveDraft === true ?
null : this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
this.state.handleTekTekTek == 1 ? null : :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.state.handleTekTekTek == 1 ? null :
setTimeout(() => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.backToMonthlyReport('draft') setTimeout(() => {
}, 100); this.backToMonthlyReport('draft')
}) }, 100);
})
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -1635,7 +1667,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1635,7 +1667,7 @@ export default class TaxPlanningMR extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
...@@ -1646,7 +1678,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1646,7 +1678,7 @@ export default class TaxPlanningMR extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
...@@ -1726,13 +1758,13 @@ export default class TaxPlanningMR extends Component { ...@@ -1726,13 +1758,13 @@ export default class TaxPlanningMR extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.state.saveDraft === true ? onClick={() => this.state.saveDraft === true ?
null this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
...@@ -1750,12 +1782,12 @@ export default class TaxPlanningMR extends Component { ...@@ -1750,12 +1782,12 @@ export default class TaxPlanningMR extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => this.state.editable === true ? onClick={() => this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
......
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