Commit 864c576d authored by d.arizona's avatar d.arizona

apdet

parent bc14faf5
...@@ -466,7 +466,7 @@ export default class MonthlyReport extends Component { ...@@ -466,7 +466,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id, "months": this.state.month.month_id,
"status": selectedStatus "status": selectedStatus
} }
this.setState({isApprovedMB: true})
api.create().getCompanySubmittedMonthly(body).then(response => { api.create().getCompanySubmittedMonthly(body).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -507,12 +507,12 @@ export default class MonthlyReport extends Component { ...@@ -507,12 +507,12 @@ export default class MonthlyReport extends Component {
} else { } else {
// console.log(this.state.listCompany) // console.log(this.state.listCompany)
// console.log(this.state.company_submit) // console.log(this.state.company_submit)
this.setState({ listRevision: null, revision: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false }) this.setState({ listRevision: null, revision: null, dataTable: [], lastRevision: "", visibleTableHistory: false })
} }
// //
}) })
} else { } else {
this.setState({ listRevision: null, revision: null, listCompany: null, company: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false, loading: false }, () => { this.setState({ listRevision: null, revision: null, listCompany: null, company: null, dataTable: [], lastRevision: "", visibleTableHistory: false, loading: false }, () => {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}) })
} }
...@@ -605,7 +605,7 @@ export default class MonthlyReport extends Component { ...@@ -605,7 +605,7 @@ export default class MonthlyReport extends Component {
console.log(response) console.log(response)
if (this.state.btnCreate === true && this.state.btnEdit === true) { if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable'); console.log('editable');
this.setState({ isApprover: false, checkApprover: false }) this.setState({ isApprover: this.state.approverTrue? true : false, checkApprover: this.state.approverTrue? true : false })
} else { } else {
console.log('just view'); console.log('just view');
this.setState({ isApprover: true, checkApprover: true }) this.setState({ isApprover: true, checkApprover: true })
...@@ -883,8 +883,8 @@ export default class MonthlyReport extends Component { ...@@ -883,8 +883,8 @@ export default class MonthlyReport extends Component {
validate() { validate() {
this.setState({ loading: true }, () => { this.setState({ loading: true, selectedStatus: this.state.listStatus }, () => {
document.body.style.overflow = 'hidden'; // document.body.style.overflow = 'hidden';
}) })
let array = [] let array = []
let canSubmit = true let canSubmit = true
...@@ -909,7 +909,7 @@ export default class MonthlyReport extends Component { ...@@ -909,7 +909,7 @@ export default class MonthlyReport extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getPermission() this.getMonthlyReportID()
} }
} }
}) })
...@@ -927,7 +927,7 @@ export default class MonthlyReport extends Component { ...@@ -927,7 +927,7 @@ export default class MonthlyReport extends Component {
} }
validateRevision() { validateRevision() {
this.scrollToMyRef() // this.scrollToMyRef()
let arrayRevisi = this.state.detailRevisiCheck let arrayRevisi = this.state.detailRevisiCheck
let remarksKosong = 0 let remarksKosong = 0
arrayRevisi.map((item, index) => { arrayRevisi.map((item, index) => {
...@@ -944,9 +944,10 @@ export default class MonthlyReport extends Component { ...@@ -944,9 +944,10 @@ export default class MonthlyReport extends Component {
} }
approvalSubmission(type) { approvalSubmission(type) {
this.scrollToMyRef() // this.scrollToMyRef()
this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden'; this.setState({ loading: true, selectedStatus: this.state.listStatus }, () => {
// document.body.style.overflow = 'hidden';
}) })
let body = { let body = {
"approval_id": this.state.approverID, "approval_id": this.state.approverID,
...@@ -957,10 +958,11 @@ export default class MonthlyReport extends Component { ...@@ -957,10 +958,11 @@ export default class MonthlyReport extends Component {
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"months": this.state.month.month_id,
"min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'), "min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'),
"max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD') "max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD')
} }
// // // console.log(payload) console.log(payload)
// // console.log(this.props.location); // // console.log(this.props.location);
// // console.log(body) // // console.log(body)
api.create().approvalMonthly(body).then((res) => { api.create().approvalMonthly(body).then((res) => {
...@@ -970,7 +972,7 @@ export default class MonthlyReport extends Component { ...@@ -970,7 +972,7 @@ export default class MonthlyReport extends Component {
if (type == 'revision') { if (type == 'revision') {
api.create().createPeriodeRevisionMonthly(payload).then((res)) api.create().createPeriodeRevisionMonthly(payload).then((res))
} }
this.getPermission() this.getMonthlyReportID()
}) })
} }
...@@ -1254,7 +1256,7 @@ export default class MonthlyReport extends Component { ...@@ -1254,7 +1256,7 @@ export default class MonthlyReport extends Component {
); );
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} ref={this.myRef}> <div style={{ flex: 1, backgroundColor: '#f8f8f8', overflow: 'scroll' }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert} {this.state.messageAlert}
...@@ -1345,7 +1347,11 @@ export default class MonthlyReport extends Component { ...@@ -1345,7 +1347,11 @@ export default class MonthlyReport extends Component {
// this.getCompanySubmitted() // this.getCompanySubmitted()
// } else { // } else {
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false })
this.getRevision() if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
// } // }
})} })}
disableClearable disableClearable
...@@ -1361,7 +1367,11 @@ export default class MonthlyReport extends Component { ...@@ -1361,7 +1367,11 @@ export default class MonthlyReport extends Component {
// this.getCompanySubmitted() // this.getCompanySubmitted()
// } else { // } else {
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false })
this.getRevision() if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
// } // }
})} })}
disableClearable disableClearable
...@@ -1535,10 +1545,13 @@ export default class MonthlyReport extends Component { ...@@ -1535,10 +1545,13 @@ export default class MonthlyReport extends Component {
</div> : this.state.lastStatus === 'WAITING FOR APPROVAL' ? </div> : this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}> <div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span> <span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> : this.state.lastStatus === 'APPROVED' ? </div> : this.state.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}> <div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus}`}</span> <span>{this.state.textRevision}</span>
</div> : null </div> : this.state.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus}`}</span>
</div> : null
: :
this.state.lastStatus === 'SUBMITTED' ? this.state.lastStatus === 'SUBMITTED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}> <div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
...@@ -1655,7 +1668,7 @@ export default class MonthlyReport extends Component { ...@@ -1655,7 +1668,7 @@ export default class MonthlyReport extends Component {
</div> </div>
</div> : null </div> : null
: :
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ? (this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button <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