Commit 17428aa3 authored by d.arizona's avatar d.arizona

update approval sueradmin

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