Commit ce99fcbe authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

update superadmin approval & cf summ

See merge request !1538
parents dc2f45e1 6b4f7cdc
...@@ -478,6 +478,10 @@ const create = (type = "") => { ...@@ -478,6 +478,10 @@ const create = (type = "") => {
const getMonitoringMR = (body) => api.get(`transaction/monitoring/monthly_report/${body.year}/${body.month}`) const getMonitoringMR = (body) => api.get(`transaction/monitoring/monthly_report/${body.year}/${body.month}`)
const getMonitoringRO = (body) => api.get(`transaction/monitoring/rolling_outlook/${body.year}/${body.quarter}`) const getMonitoringRO = (body) => api.get(`transaction/monitoring/rolling_outlook/${body.year}/${body.quarter}`)
const getMonitoringOLPA = (body) => api.get(`transaction/monitoring/outlook_pa?year=${body.year}`) const getMonitoringOLPA = (body) => api.get(`transaction/monitoring/outlook_pa?year=${body.year}`)
// Superadmin Approve
const getListApprover = (report,monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`)
const getIdToken = (userId) => api.get(`transaction/get_token/${userId}`)
// ------ // ------
// STEP 3 // STEP 3
// ------ // ------
...@@ -823,6 +827,8 @@ const create = (type = "") => { ...@@ -823,6 +827,8 @@ const create = (type = "") => {
getMonitoringMR, getMonitoringMR,
getMonitoringRO, getMonitoringRO,
getMonitoringOLPA, getMonitoringOLPA,
getListApprover,
getIdToken
} }
} }
......
...@@ -75,7 +75,9 @@ export default class BudgetTahunan extends Component { ...@@ -75,7 +75,9 @@ export default class BudgetTahunan extends Component {
userType: '', userType: '',
PLBSFAMSubmitted: false, PLBSFAMSubmitted: false,
PLID: null, PLID: null,
FRID: null FRID: null,
listApprover: null,
approver: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -292,7 +294,7 @@ export default class BudgetTahunan extends Component { ...@@ -292,7 +294,7 @@ export default class BudgetTahunan extends Component {
} }
const handleOpbal = (item) => { const handleOpbal = (item) => {
let isUpload = false let isUpload = false
if (Number(this.state.periode.periode) <= 2020 ) { if (Number(this.state.periode.periode) <= 2020) {
isUpload = true isUpload = true
} else { } else {
isUpload = item isUpload = item
...@@ -531,7 +533,7 @@ export default class BudgetTahunan extends Component { ...@@ -531,7 +533,7 @@ export default class BudgetTahunan 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,
"is_approver": this.state.permissionhandle ? this.state.permissionhandle : this.state.isApprover "is_approver": this.state.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : (this.state.permissionhandle ? this.state.permissionhandle : this.state.isApprover)
} }
console.log(payload) console.log(payload)
api.create().getSubmission(payload).then(response => { api.create().getSubmission(payload).then(response => {
...@@ -553,6 +555,23 @@ export default class BudgetTahunan extends Component { ...@@ -553,6 +555,23 @@ export default class BudgetTahunan extends Component {
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
// this.getCashFlow(type) // this.getCashFlow(type)
// this.getPL(type) // this.getPL(type)
if (this.state.isAdmin) {
console.log('masuk')
api.create().getListApprover('master_budget',this.state.submissionID).then((response) => {
console.log(response)
if (response.data.data) {
let dataListApprover = []
response.data.data.map((item,index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname})
})
let defaultProps = {
options: dataListApprover,
getOptionLabel: (option) => option.fullname,
};
this.setState({listApprover: defaultProps})
}
})
}
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
// this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type) this.getPL(type)
...@@ -1988,8 +2007,16 @@ export default class BudgetTahunan extends Component { ...@@ -1988,8 +2007,16 @@ export default class BudgetTahunan extends Component {
}) })
} }
approvalSubmission(type) { async approvalSubmission(type) {
// this.scrollToMyRef() // 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';
}) })
...@@ -2007,15 +2034,23 @@ export default class BudgetTahunan extends Component { ...@@ -2007,15 +2034,23 @@ export default class BudgetTahunan extends Component {
console.log(payload) console.log(payload)
// // console.log(this.props.location); // // console.log(this.props.location);
console.log(body) console.log(body)
api.create().approvalSubmission(body).then((res) => { setTimeout(() => {
console.log(res) api.create().approvalSubmission(body).then((res) => {
// this.setState({ loading: false }, () => { console.log(res)
// }) // this.setState({ loading: false }, () => {
if (type == 'revision') { // })
api.create().createPeriodeRevision(payload).then((res)) if (this.state.isAdmin && type == 'approve') {
} localStorage.setItem(Constant.TOKEN, realToken)
this.getSubmission() this.setState({visibleApproveSuperadmin: false})
}) }
setTimeout(() => {
if (type == 'revision') {
api.create().createPeriodeRevision(payload).then((res))
}
this.getSubmission()
}, 400);
})
}, 200);
} }
clickDetail(item, id, revision, status) { clickDetail(item, id, revision, status) {
...@@ -2276,6 +2311,10 @@ export default class BudgetTahunan extends Component { ...@@ -2276,6 +2311,10 @@ export default class BudgetTahunan extends Component {
} }
} }
handleApproveAdmin() {
this.setState({ visibleApproveSuperadmin: true })
}
render() { render() {
const handleMaxDate = () => { const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD')) let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
...@@ -2358,8 +2397,8 @@ export default class BudgetTahunan extends Component { ...@@ -2358,8 +2397,8 @@ export default class BudgetTahunan extends Component {
}} }}
onClick={() => onClick={() =>
tableMeta.rowData[5] == true ? tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
: null : null
} }
> >
{/* {this.state.isApprover == true ? {/* {this.state.isApprover == true ?
...@@ -2785,9 +2824,10 @@ export default class BudgetTahunan extends Component { ...@@ -2785,9 +2824,10 @@ export default class BudgetTahunan extends Component {
</div> </div>
</div> </div>
: :
this.state.checkApprover === true ? this.state.isAdmin && (this.state.lastStatus == 'WAITING FOR YOUR APPROVAL' || this.state.lastStatus == 'WAITING FOR APPROVAL') ?
this.state.lastStatus === 'WAITING FOR REVIEW' ? <div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2795,65 +2835,68 @@ export default class BudgetTahunan extends Component { ...@@ -2795,65 +2835,68 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => onClick={() => this.handleApproveAdmin()}
this.approvalSubmission('review')
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div> </div>
</button> </button>
</div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ? </div>
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}> </div>
<div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
: :
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ? this.state.checkApprover === true ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > this.state.lastStatus === 'WAITING FOR REVIEW' ?
<button <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
outline: 'none', borderColor: 'transparent',
}} outline: 'none',
onClick={() => this.validate()} }}
> onClick={() =>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> this.approvalSubmission('review')
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography> }
</div> >
</button> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
</div> : <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ? </div>
</button>
</div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ?
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
:
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ?
<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={{
...@@ -2862,13 +2905,29 @@ export default class BudgetTahunan extends Component { ...@@ -2862,13 +2905,29 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => this.approvalSubmission('cancel')} onClick={() => this.validate()}
> >
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div> </div>
</button> </button>
</div> : null </div> :
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('cancel')}
>
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div> : null
} }
</Paper> </Paper>
...@@ -3037,7 +3096,7 @@ export default class BudgetTahunan extends Component { ...@@ -3037,7 +3096,7 @@ export default class BudgetTahunan extends Component {
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
// PLBSFAMSubmitted={false} // PLBSFAMSubmitted={false}
PLBSFAMSubmitted={this.state.lastStatus == 'APPROVED'? true : false} PLBSFAMSubmitted={this.state.lastStatus == 'APPROVED' ? true : false}
createCashFlow={this.createCashFlow.bind(this)} createCashFlow={this.createCashFlow.bind(this)}
/> />
) )
...@@ -3160,6 +3219,68 @@ export default class BudgetTahunan extends Component { ...@@ -3160,6 +3219,68 @@ export default class BudgetTahunan extends Component {
</div> </div>
) )
} }
{this.state.visibleApproveSuperadmin && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Superadmin Approve</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div className="border-bottom" style={{ padding: 20 }}>
<span>Choose approver you want</span>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listApprover}
id="periode"
onChange={(event, newInputValue) => this.setState({ approver: newInputValue })}
disabled={false}
disableClearable
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Approver" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.approver}
/>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
</div>
</button>
</div>
<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')}
>
<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>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div > </div >
); );
} }
......
...@@ -18976,14 +18976,86 @@ export default class TableSubHolding extends Component { ...@@ -18976,14 +18976,86 @@ export default class TableSubHolding extends Component {
}, },
] ]
const handleCashend = (tableMeta, col) => { const handleCashend = (tableMeta, col, type) => {
let indexRow = tableMeta.rowIndex let value = 0
let indexCol = tableMeta.columnIndex if (String(type).includes('percent')) {
let dataTable = dataTable2 let mtd_actual = tableMeta.rowData[109] == '' ? 0 : Number(tableMeta.rowData[109])
let value = Number(dataTable[indexRow-2][col]) + Number(dataTable[indexRow-1][col]) let mtd = tableMeta.rowData[110] == '' ? 0 : Number(tableMeta.rowData[110])
// console.log(mtd)
// let persenMtd = Number(mtd_actual / mtd)
let persenMtd = 0
if (mtd < 0) {
if (mtd_actual >= mtd) {
persenMtd = ((mtd - mtd_actual) / mtd + 1 )
} else {
persenMtd = ((mtd - mtd_actual) / mtd)
}
}
else {
persenMtd = Number(mtd_actual / mtd)
}
let ytd_actual = tableMeta.rowData[113 ] == '' ? 0 : Number(tableMeta.rowData[113 ])
let ytd = tableMeta.rowData[114] == '' ? 0 : Number(tableMeta.rowData[114])
// let persenYtd = Number(ytd_actual / ytd)
let persenYtd = 0
if (ytd < 0) {
if (ytd_actual >= ytd) {
persenYtd = ((ytd - ytd_actual) / ytd + 1 )
} else {
persenYtd = ((ytd - ytd_actual) / ytd)
}
}
else {
persenYtd = Number(ytd_actual/ytd)
}
let quarter_actual = tableMeta.rowData[117] == '' ? 0 : Number(tableMeta.rowData[117])
let quarter = tableMeta.rowData[118] == '' ? 0 : Number(tableMeta.rowData[118])
// let persenQuarter = Number(quarter_actual / quarter)
let persenQuarter = 0
if (quarter < 0) {
if (quarter_actual >= quarter) {
persenQuarter = (quarter - quarter_actual) / quarter + 1
} else {
persenQuarter = (quarter - quarter_actual) / quarter
}
}
else {
persenQuarter = quarter_actual / quarter
}
let fy_actual = tableMeta.rowData[121] == '' ? 0 : Number(tableMeta.rowData[121])
let fy = tableMeta.rowData[122] == '' ? 0 : Number(tableMeta.rowData[122])
// let persenFy = Number(fy_actual / fy)
let persenFy = 0
if (fy < 0) {
if (fy_actual >= fy) {
persenFy = (fy - fy_actual) / fy + 1
} else {
persenFy = (fy - fy_actual) / fy
}
}
else {
persenFy = fy_actual / fy
}
value = String(type).includes('MTD') ? persenMtd : String(type).includes('YTD') ? persenYtd : String(type).includes('Quarter') ? persenQuarter : persenFy
value = (value == Infinity || value == -Infinity || isNaN(value) ? 0 : Number(value * 100).toFixed(1))
// value = isNaN(value) || value == 'Infinity' || value == '-Infinity' ? (value == '' || value == 0 ? -0 : 0) : (value== '' || value == 0 ? persenFy * -100 : persenFy * 100)
} else {
let indexRow = tableMeta.rowIndex
let indexCol = tableMeta.columnIndex
let dataTable = dataTable2
value = Number(dataTable[indexRow-2][col]) + Number(dataTable[indexRow-1][col])
value = Number(value).toFixed(1)
dataTable2[tableMeta.rowIndex][col] = value
}
return Number(value).toFixed(1) return value
} }
const columnDBCF = [ const columnDBCF = [
{ {
...@@ -19138,7 +19210,7 @@ export default class TableSubHolding extends Component { ...@@ -19138,7 +19210,7 @@ export default class TableSubHolding extends Component {
disabled={true} disabled={true}
suffix={'%'} suffix={'%'}
// value={Number(tableMeta.rowData[111]).toFixed(1)} // value={Number(tableMeta.rowData[111]).toFixed(1)}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 111) : Number(tableMeta.rowData[111]).toFixed(1)} value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 111, 'percentMTD') : Number(tableMeta.rowData[111]).toFixed(1)}
/> />
} }
/> />
...@@ -19276,7 +19348,7 @@ export default class TableSubHolding extends Component { ...@@ -19276,7 +19348,7 @@ export default class TableSubHolding extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
suffix={'%'} suffix={'%'}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 115) : Number(tableMeta.rowData[115]).toFixed(1)} value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 115, 'percentYTD') : Number(tableMeta.rowData[115]).toFixed(1)}
// value={Number(tableMeta.rowData[115]).toFixed(1)} // value={Number(tableMeta.rowData[115]).toFixed(1)}
/> />
} }
...@@ -19416,7 +19488,7 @@ export default class TableSubHolding extends Component { ...@@ -19416,7 +19488,7 @@ export default class TableSubHolding extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
suffix={'%'} suffix={'%'}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 119) : Number(tableMeta.rowData[119]).toFixed(1)} value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 119, 'percentQuarter') : Number(tableMeta.rowData[119]).toFixed(1)}
// value={Number(tableMeta.rowData[119]).toFixed(1)} // value={Number(tableMeta.rowData[119]).toFixed(1)}
/> />
} }
...@@ -19554,7 +19626,7 @@ export default class TableSubHolding extends Component { ...@@ -19554,7 +19626,7 @@ export default class TableSubHolding extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 123) : Number(tableMeta.rowData[123]).toFixed(1)} value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'cash at the end of the period' ? handleCashend(tableMeta, 123, 'percentFY') : Number(tableMeta.rowData[123]).toFixed(1)}
// value={Number(tableMeta.rowData[123]).toFixed(1)} // value={Number(tableMeta.rowData[123]).toFixed(1)}
suffix={'%'} suffix={'%'}
/> />
...@@ -75,7 +75,9 @@ export default class MonthlyReport extends Component { ...@@ -75,7 +75,9 @@ export default class MonthlyReport extends Component {
dbPL: [], dbPL: [],
PLBSFAMSubmitted: false, PLBSFAMSubmitted: false,
PLID: null, PLID: null,
monthHome: null monthHome: null,
listApprover: null,
approver: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -606,7 +608,7 @@ export default class MonthlyReport extends Component { ...@@ -606,7 +608,7 @@ export default class MonthlyReport extends Component {
"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, "months": this.state.month.month_id,
"is_approver": this.state.isApprover "is_approver": this.state.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : this.state.isApprover
} }
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false })
api.create().getMonthlyReportID(payload).then(response => { api.create().getMonthlyReportID(payload).then(response => {
...@@ -626,6 +628,23 @@ export default class MonthlyReport extends Component { ...@@ -626,6 +628,23 @@ export default class MonthlyReport extends Component {
// // console.log(this.state.lastStatus); // // console.log(this.state.lastStatus);
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (this.state.isAdmin) {
console.log('masuk')
api.create().getListApprover('monthly_report',this.state.monthlyReportId).then((response) => {
console.log(response)
if (response.data.data) {
let dataListApprover = []
response.data.data.map((item,index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname})
})
let defaultProps = {
options: dataListApprover,
getOptionLabel: (option) => option.fullname,
};
this.setState({listApprover: defaultProps})
}
})
}
// this.getPL(type) // this.getPL(type)
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
this.getPL(type) this.getPL(type)
...@@ -1024,9 +1043,14 @@ export default class MonthlyReport extends Component { ...@@ -1024,9 +1043,14 @@ export default class MonthlyReport extends Component {
} }
} }
approvalSubmission(type) { async approvalSubmission(type) {
// this.scrollToMyRef() // this.scrollToMyRef()
let realToken = await localStorage.getItem(Constant.TOKEN)
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';
}) })
...@@ -1046,15 +1070,23 @@ export default class MonthlyReport extends Component { ...@@ -1046,15 +1070,23 @@ export default class MonthlyReport extends Component {
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) => { setTimeout(() => {
console.log(res) api.create().approvalMonthly(body).then((res) => {
// this.setState({ loading: false }, () => { console.log(res)
// }) // this.setState({ loading: false }, () => {
if (type == 'revision') { // })
api.create().createPeriodeRevisionMonthly(payload).then((res)) if (this.state.isAdmin && type == 'approve') {
} localStorage.setItem(Constant.TOKEN, realToken)
this.getMonthlyReportID() this.setState({visibleApproveSuperadmin: false})
}) }
setTimeout(() => {
if (type == 'revision') {
api.create().createPeriodeRevisionMonthly(payload).then((res))
}
this.getMonthlyReportID()
}, 300);
})
}, 100);
} }
getCashFlow(type) { getCashFlow(type) {
...@@ -1794,10 +1826,10 @@ export default class MonthlyReport extends Component { ...@@ -1794,10 +1826,10 @@ export default class MonthlyReport extends Component {
this.setState({ dbPL: listPL }, () => { this.setState({ dbPL: listPL }, () => {
if (type != undefined) { if (type != undefined) {
if (type == 'PL') { if (type == 'PL') {
// console.log(this.state.dbPL) // console.log(this.state.dbPL)
// this.setState({ loading: false }) // this.setState({ loading: false })
console.log('tarik sis') console.log('tarik sis')
this.createPL() this.createPL()
} }
} }
}) })
...@@ -2099,6 +2131,10 @@ export default class MonthlyReport extends Component { ...@@ -2099,6 +2131,10 @@ export default class MonthlyReport extends Component {
}) })
} }
handleApproveAdmin() {
this.setState({ visibleApproveSuperadmin: true })
}
render() { render() {
const columns = ["#", "Report Type", const columns = ["#", "Report Type",
{ {
...@@ -2743,9 +2779,10 @@ export default class MonthlyReport extends Component { ...@@ -2743,9 +2779,10 @@ export default class MonthlyReport extends Component {
</div> </div>
</div> </div>
: :
this.state.checkApprover ? this.state.isAdmin && (this.state.lastStatus == 'WAITING FOR YOUR APPROVAL' || this.state.lastStatus == 'WAITING FOR APPROVAL')?
this.state.lastStatus === 'WAITING FOR REVIEW' ? <div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2753,65 +2790,17 @@ export default class MonthlyReport extends Component { ...@@ -2753,65 +2790,17 @@ export default class MonthlyReport extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => onClick={() => this.handleApproveAdmin()}
this.approvalSubmission('review')
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div> </div>
</button> </button>
</div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ? </div>
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}> </div>
<div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
: :
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit ? this.state.checkApprover ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > this.state.lastStatus === 'WAITING FOR REVIEW' ?
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</button>
</div> :
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ?
<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={{
...@@ -2820,13 +2809,80 @@ export default class MonthlyReport extends Component { ...@@ -2820,13 +2809,80 @@ export default class MonthlyReport extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => this.approvalSubmission('cancel')} onClick={() =>
this.approvalSubmission('review')
}
> >
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
</div> </div>
</button> </button>
</div> : null </div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ?
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
:
(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' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</button>
</div> :
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('cancel')}
>
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div> : null
} }
</Paper> </Paper>
...@@ -3152,6 +3208,68 @@ export default class MonthlyReport extends Component { ...@@ -3152,6 +3208,68 @@ export default class MonthlyReport extends Component {
</div> </div>
) )
} }
{this.state.visibleApproveSuperadmin && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Superadmin Approve</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div className="border-bottom" style={{ padding: 20 }}>
<span>Choose approver you want</span>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listApprover}
id="periode"
onChange={(event, newInputValue) => this.setState({ approver: newInputValue })}
disabled={false}
disableClearable
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Approver" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.approver}
/>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
</div>
</button>
</div>
<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')}
>
<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>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div > </div >
); );
} }
......
...@@ -69,7 +69,9 @@ export default class OutlookPA extends Component { ...@@ -69,7 +69,9 @@ export default class OutlookPA extends Component {
listStatus: [], listStatus: [],
selectedStatus: [], selectedStatus: [],
prevRevision: false, prevRevision: false,
dbPL: [] dbPL: [],
listApprover: null,
approver: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -467,7 +469,7 @@ export default class OutlookPA extends Component { ...@@ -467,7 +469,7 @@ export default class OutlookPA 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,
"is_approver": this.state.isApprover "is_approver": this.state.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : this.state.isApprover
} }
api.create().getOutlookPAID(payload).then(response => { api.create().getOutlookPAID(payload).then(response => {
console.log(response) console.log(response)
...@@ -482,6 +484,23 @@ export default class OutlookPA extends Component { ...@@ -482,6 +484,23 @@ export default class OutlookPA extends Component {
btnApprove: response.data.data.is_submit btnApprove: response.data.data.is_submit
}, () => { }, () => {
// console.log(this.state.lastStatus); // console.log(this.state.lastStatus);
if (this.state.isAdmin) {
console.log('masuk')
api.create().getListApprover('outlook_pa',this.state.outlook_pa_id).then((response) => {
console.log(response)
if (response.data.data) {
let dataListApprover = []
response.data.data.map((item,index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname})
})
let defaultProps = {
options: dataListApprover,
getOptionLabel: (option) => option.fullname,
};
this.setState({listApprover: defaultProps})
}
})
}
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
...@@ -539,8 +558,16 @@ export default class OutlookPA extends Component { ...@@ -539,8 +558,16 @@ export default class OutlookPA extends Component {
}) })
} }
approvalSubmission(type) { async approvalSubmission(type) {
this.scrollToMyRef() 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(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,
...@@ -553,15 +580,32 @@ export default class OutlookPA extends Component { ...@@ -553,15 +580,32 @@ export default class OutlookPA extends Component {
"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)
api.create().approvalSubmissionOLPA(body).then((res) => { // api.create().approvalSubmissionOLPA(body).then((res) => {
console.log(res) // console.log(res)
this.setState({ loading: false }, () => { // // this.setState({ loading: false }, () => {
this.getOutlookPAID() // this.getOutlookPAID()
// // })
// if (type == 'revision') {
// api.create().createPeriodeRevisionOLPA(payload).then((res) => console.log(res))
// }
// })
setTimeout(() => {
api.create().approvalSubmissionOLPA(body).then((res) => {
console.log(res)
// this.setState({ loading: false }, () => {
// })
if (this.state.isAdmin && type == 'approve') {
localStorage.setItem(Constant.TOKEN, realToken)
this.setState({visibleApproveSuperadmin: false})
}
setTimeout(() => {
if (type == 'revision') {
api.create().createPeriodeRevisionOLPA(payload).then((res))
}
this.getOutlookPAID()
}, 300);
}) })
if (type == 'revision') { }, 100);
api.create().createPeriodeRevisionOLPA(payload).then((res) => console.log(res))
}
})
} }
clickDetail(item, id, revision, status) { clickDetail(item, id, revision, status) {
...@@ -1296,6 +1340,10 @@ export default class OutlookPA extends Component { ...@@ -1296,6 +1340,10 @@ export default class OutlookPA extends Component {
}) })
} }
handleApproveAdmin() {
this.setState({visibleApproveSuperadmin: true})
}
render() { render() {
const handleMaxDate = () => { const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD')) let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
...@@ -1788,9 +1836,10 @@ export default class OutlookPA extends Component { ...@@ -1788,9 +1836,10 @@ export default class OutlookPA extends Component {
</div> </div>
</div> </div>
: :
this.state.checkApprover === true ? this.state.isAdmin && (this.state.lastStatus == 'WAITING FOR YOUR APPROVAL' || this.state.lastStatus == 'WAITING FOR APPROVAL') ?
this.state.lastStatus === 'WAITING FOR REVIEW' ? <div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1798,65 +1847,68 @@ export default class OutlookPA extends Component { ...@@ -1798,65 +1847,68 @@ export default class OutlookPA extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => onClick={() => this.handleApproveAdmin()}
this.approvalSubmission('review')
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div> </div>
</button> </button>
</div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ? </div>
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}> </div>
<div className="col-1">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
: :
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ? this.state.checkApprover === true ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > this.state.lastStatus === 'WAITING FOR REVIEW' ?
<button <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
outline: 'none', borderColor: 'transparent',
}} outline: 'none',
onClick={() => this.validate()} }}
> onClick={() =>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> this.approvalSubmission('review')
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography> }
</div> >
</button> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
</div> : <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ? </div>
</button>
</div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ?
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div className="col-1">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
:
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ?
<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={{
...@@ -1865,13 +1917,29 @@ export default class OutlookPA extends Component { ...@@ -1865,13 +1917,29 @@ export default class OutlookPA extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => this.approvalSubmission('cancel')} onClick={() => this.validate()}
> >
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div> </div>
</button> </button>
</div> : null </div> :
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('cancel')}
>
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div> : null
} }
</Paper> </Paper>
...@@ -2128,6 +2196,68 @@ export default class OutlookPA extends Component { ...@@ -2128,6 +2196,68 @@ export default class OutlookPA extends Component {
</div> </div>
</div> </div>
)} )}
{this.state.visibleApproveSuperadmin && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Superadmin Approve</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div className="border-bottom" style={{ padding: 20 }}>
<span>Choose approver you want</span>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listApprover}
id="periode"
onChange={(event, newInputValue) => this.setState({ approver: newInputValue })}
disabled={false}
disableClearable
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Approver" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.approver}
/>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
</div>
</button>
</div>
<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')}
>
<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>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div > </div >
); );
} }
......
...@@ -75,7 +75,9 @@ export default class RollingOutlook extends Component { ...@@ -75,7 +75,9 @@ export default class RollingOutlook extends Component {
{ value: 'q3', name: 'Q3' }, { value: 'q3', name: 'Q3' },
// {value: 'ol_pa', name: 'OL PA'}, // {value: 'ol_pa', name: 'OL PA'},
], ],
quarter: null quarter: null,
listApprover: null,
approver: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -526,7 +528,7 @@ export default class RollingOutlook extends Component { ...@@ -526,7 +528,7 @@ export default class RollingOutlook 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,
"is_approver": this.state.isApprover, "is_approver": this.state.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : this.state.isApprover,
"quartal": this.state.quarter.value "quartal": this.state.quarter.value
} }
api.create().getRollingOutlookID(payload).then(response => { api.create().getRollingOutlookID(payload).then(response => {
...@@ -547,6 +549,23 @@ export default class RollingOutlook extends Component { ...@@ -547,6 +549,23 @@ export default class RollingOutlook extends Component {
msgApproveRO: response.data.data.message_approval_rolling_outlook msgApproveRO: response.data.data.message_approval_rolling_outlook
}, () => { }, () => {
console.log(this.state.lastStatus); console.log(this.state.lastStatus);
if (this.state.isAdmin) {
console.log('masuk')
api.create().getListApprover('rolling_outlook',this.state.rollingOutlookID).then((response) => {
console.log(response)
if (response.data.data) {
let dataListApprover = []
response.data.data.map((item,index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname})
})
let defaultProps = {
options: dataListApprover,
getOptionLabel: (option) => option.fullname,
};
this.setState({listApprover: defaultProps})
}
})
}
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
...@@ -605,8 +624,16 @@ export default class RollingOutlook extends Component { ...@@ -605,8 +624,16 @@ export default class RollingOutlook extends Component {
}) })
} }
approvalSubmission(type) { async approvalSubmission(type) {
// this.scrollToMyRef() // 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(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,
...@@ -622,15 +649,35 @@ export default class RollingOutlook extends Component { ...@@ -622,15 +649,35 @@ export default class RollingOutlook extends Component {
"quartal": this.state.quarter.value "quartal": this.state.quarter.value
} }
console.log(payload) console.log(payload)
api.create().approvalRolling(body).then((res) => { // api.create().approvalRolling(body).then((res) => {
console.log(res) // console.log(res)
this.setState({ loading: false }, () => { // // this.setState({ loading: false }, () => {
this.getRollingOutlookID() // this.getRollingOutlookID()
// // })
// if (type == 'revision') {
// api.create().createPeriodeRevisionRO(payload).then((res) => console.log(res))
// }
// })
setTimeout(() => {
api.create().approvalRolling(body).then((res) => {
console.log(res)
// this.setState({ loading: false }, () => {
// })
if (this.state.isAdmin && type == 'approve') {
localStorage.setItem(Constant.TOKEN, realToken)
this.setState({visibleApproveSuperadmin: false})
}
setTimeout(() => {
if (type == 'revision') {
api.create().createPeriodeRevisionRO(payload).then((res))
}
this.setState({ loading: false }, () => {
this.getRollingOutlookID()
})
}, 300);
}) })
if (type == 'revision') { }, 100);
api.create().createPeriodeRevisionRO(payload).then((res) => console.log(res))
}
})
} }
clickDetail(item, id, revision, status) { clickDetail(item, id, revision, status) {
...@@ -1355,6 +1402,10 @@ export default class RollingOutlook extends Component { ...@@ -1355,6 +1402,10 @@ export default class RollingOutlook extends Component {
}) })
} }
handleApproveAdmin() {
this.setState({ visibleApproveSuperadmin: true })
}
render() { render() {
const handleMaxDate = () => { const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD')) let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
...@@ -1864,9 +1915,10 @@ export default class RollingOutlook extends Component { ...@@ -1864,9 +1915,10 @@ export default class RollingOutlook extends Component {
</div> </div>
</div> </div>
: :
this.state.checkApprover === true ? this.state.isAdmin && (this.state.lastStatus == 'WAITING FOR YOUR APPROVAL' || this.state.lastStatus == 'WAITING FOR APPROVAL') ?
this.state.lastStatus === 'WAITING FOR REVIEW' ? <div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1874,65 +1926,17 @@ export default class RollingOutlook extends Component { ...@@ -1874,65 +1926,17 @@ export default class RollingOutlook extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => onClick={() => this.handleApproveAdmin()}
this.approvalSubmission('review')
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div> </div>
</button> </button>
</div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ? </div>
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}> </div>
<div className="col-1">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
: :
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ? this.state.checkApprover === true ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > this.state.lastStatus === 'WAITING FOR REVIEW' ?
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</button>
</div> :
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ?
<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={{
...@@ -1941,13 +1945,80 @@ export default class RollingOutlook extends Component { ...@@ -1941,13 +1945,80 @@ export default class RollingOutlook extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => this.approvalSubmission('cancel')} onClick={() =>
this.approvalSubmission('review')
}
> >
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
</div> </div>
</button> </button>
</div> : null </div> : (this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' && this.state.btnApprove) ?
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div className="col-1">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button>
</div>
</div> : null
:
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit === true ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</button>
</div> :
this.state.lastStatus === 'SUBMITTED' && this.state.submitter ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('cancel')}
>
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div> : null
} }
</Paper> </Paper>
...@@ -2207,6 +2278,68 @@ export default class RollingOutlook extends Component { ...@@ -2207,6 +2278,68 @@ export default class RollingOutlook extends Component {
</div> </div>
</div> </div>
)} )}
{this.state.visibleApproveSuperadmin && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Superadmin Approve</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div className="border-bottom" style={{ padding: 20 }}>
<span>Choose approver you want</span>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listApprover}
id="periode"
onChange={(event, newInputValue) => this.setState({ approver: newInputValue })}
disabled={false}
disableClearable
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Approver" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.approver}
/>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => this.setState({ visibleApproveSuperadmin: false })}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
</div>
</button>
</div>
<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')}
>
<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>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div > </div >
); );
} }
......
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