Commit 6db7b1e6 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

update approval sueradmin

See merge request !1539
parents ce99fcbe 17428aa3
......@@ -2007,23 +2007,33 @@ export default class BudgetTahunan extends Component {
})
}
async approvalSubmission(type) {
// this.scrollToMyRef()
async setHeaderTokenSuperadmin(type) {
let realToken = await localStorage.getItem(Constant.TOKEN)
if (this.state.isAdmin && type == 'approve') {
api.create().getIdToken(this.state.approver.userId).then((response) => {
// console.log(response.data.data.token)
// console.log(realToken)
console.log(response.data.data.token)
localStorage.setItem(Constant.TOKEN, response.data.data.token)
this.approvalSubmission(type, realToken)
})
}
approvalSubmission(type, realToken) {
// this.scrollToMyRef()
// let realToken = await localStorage.getItem(Constant.TOKEN)
// if (this.state.isAdmin && type == 'approve') {
// api.create().getIdToken(this.state.approver.userId).then((response) => {
// console.log(response.data.data.token)
// console.log(realToken)
// localStorage.setItem(Constant.TOKEN, response.data.data.token)
// })
// }
this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden';
})
let body = {
"approval_id": this.state.approverID,
"status": type,
"detail": this.state.detailRevisiCheck
"detail": this.state.detailRevisiCheck,
"is_superadmin": this.state.isAdmin
}
let payload = {
"company_id": this.state.company.company_id,
......@@ -3072,7 +3082,10 @@ export default class BudgetTahunan extends Component {
getReport={this.getSubmission.bind(this)}
isApprover={this.state.isApprover}
status={this.state.status}
// status={'not-yet'}
lastStatus={this.state.lastStatus}
// lastStatus={'SUBMIT'}
// prevRevision={false}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)
......@@ -3270,7 +3283,7 @@ export default class BudgetTahunan extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => this.state.approver == null ? this.setState({ alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error' }) : this.approvalSubmission('approve')}
onClick={() => this.state.approver == null ? this.setState({ alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error' }) : this.setHeaderTokenSuperadmin('approve')}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Confirm Approve</span>
......
......@@ -1043,14 +1043,22 @@ export default class MonthlyReport extends Component {
}
}
async approvalSubmission(type) {
// this.scrollToMyRef()
async setHeaderTokenSuperadmin(type) {
let realToken = await localStorage.getItem(Constant.TOKEN)
if (this.state.isAdmin && type == 'approve') {
api.create().getIdToken(this.state.approver.userId).then((response) => {
console.log(response.data.data.token)
localStorage.setItem(Constant.TOKEN, response.data.data.token)
this.approvalSubmission(type, realToken)
})
}
approvalSubmission(type, realToken) {
// this.scrollToMyRef()
// if (this.state.isAdmin && type == 'approve') {
// api.create().getIdToken(this.state.approver.userId).then((response) => {
// localStorage.setItem(Constant.TOKEN, response.data.data.token)
// })
// }
this.setState({ loading: true, selectedStatus: this.state.listStatus }, () => {
// document.body.style.overflow = 'hidden';
})
......@@ -1058,7 +1066,8 @@ export default class MonthlyReport extends Component {
"approval_id": this.state.approverID,
"status": type,
"months": this.state.month.month_id,
"detail": this.state.detailRevisiCheck
"detail": this.state.detailRevisiCheck,
"is_superadmin": this.state.isAdmin
}
let payload = {
"company_id": this.state.company.company_id,
......@@ -3259,7 +3268,7 @@ export default class MonthlyReport extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => this.state.approver == null? this.setState({alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error'}) : this.approvalSubmission('approve')}
onClick={() => this.state.approver == null? this.setState({alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error'}) : this.setHeaderTokenSuperadmin('approve')}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Confirm Approve</span>
......
......@@ -558,21 +558,30 @@ export default class OutlookPA extends Component {
})
}
async approvalSubmission(type) {
this.scrollToMyRef()
async setHeaderTokenSuperadmin(type) {
let realToken = await localStorage.getItem(Constant.TOKEN)
if (this.state.isAdmin && type == 'approve') {
api.create().getIdToken(this.state.approver.userId).then((response) => {
// console.log(realToken)
// console.log(response.data.data.token)
console.log(response.data.data.token)
localStorage.setItem(Constant.TOKEN, response.data.data.token)
this.approvalSubmission(type, realToken)
})
}
approvalSubmission(type, realToken) {
this.scrollToMyRef()
// if (this.state.isAdmin && type == 'approve') {
// api.create().getIdToken(this.state.approver.userId).then((response) => {
// // console.log(realToken)
// // console.log(response.data.data.token)
// localStorage.setItem(Constant.TOKEN, response.data.data.token)
// })
// }
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type,
"detail": this.state.detailRevisiCheck
"detail": this.state.detailRevisiCheck,
"is_superadmin": this.state.isAdmin
}
let payload = {
"company_id": this.state.company.company_id,
......@@ -2247,7 +2256,7 @@ export default class OutlookPA extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => this.state.approver == null? this.setState({alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error'}) : this.approvalSubmission('approve')}
onClick={() => this.state.approver == null? this.setState({alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error'}) : this.setHeaderTokenSuperadmin('approve')}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Confirm Approve</span>
......
......@@ -624,22 +624,31 @@ export default class RollingOutlook extends Component {
})
}
async approvalSubmission(type) {
// this.scrollToMyRef()
async setHeaderTokenSuperadmin(type) {
let realToken = await localStorage.getItem(Constant.TOKEN)
if (this.state.isAdmin && type == 'approve') {
api.create().getIdToken(this.state.approver.userId).then((response) => {
// console.log(realToken)
// console.log(response.data.data.token)
console.log(response.data.data.token)
localStorage.setItem(Constant.TOKEN, response.data.data.token)
this.approvalSubmission(type, realToken)
})
}
approvalSubmission(type, realToken) {
// this.scrollToMyRef()
// if (this.state.isAdmin && type == 'approve') {
// api.create().getIdToken(this.state.approver.userId).then((response) => {
// // console.log(realToken)
// // console.log(response.data.data.token)
// localStorage.setItem(Constant.TOKEN, response.data.data.token)
// })
// }
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type,
"detail": this.state.detailRevisiCheck,
"quartal": this.state.quarter.value
"quartal": this.state.quarter.value,
"is_superadmin": this.state.isAdmin
}
let payload = {
"company_id": this.state.company.company_id,
......@@ -2329,7 +2338,7 @@ export default class RollingOutlook extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => this.state.approver == null ? this.setState({ alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error' }) : this.approvalSubmission('approve')}
onClick={() => this.state.approver == null ? this.setState({ alert: true, messageAlert: 'Approver Cannot be Empty', tipeAlert: 'error' }) : this.setHeaderTokenSuperadmin('approve')}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Confirm Approve</span>
......
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