Commit c88c2078 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

triggerRatio!

See merge request !1541
parents ce59f4e2 8e612c51
...@@ -323,7 +323,7 @@ const create = (type = "") => { ...@@ -323,7 +323,7 @@ const create = (type = "") => {
const getReportFRLastMR = (body) => api.post('/transaction/summary_ratio/monthly_report_last_year/get_report_hierarki', body) const getReportFRLastMR = (body) => api.post('/transaction/summary_ratio/monthly_report_last_year/get_report_hierarki', body)
const getReportBSSuma = (body) => api.post('/transaction/summary_balance_sheet/summary/get_report_hierarki', body) const getReportBSSuma = (body) => api.post('/transaction/summary_balance_sheet/summary/get_report_hierarki', body)
const getDashboardCAT = (body) => api.post('/transaction/dashboard/get_dashboard_cat', body) const getDashboardCAT = (body) => api.post('/transaction/dashboard/get_dashboard_cat', body)
const getListChildDashboardCAT = (periode,month) => api.get(`/transaction/dashboard/get_home_cat/${periode}/${month}`) const getListChildDashboardCAT = (periode, month) => api.get(`/transaction/dashboard/get_home_cat/${periode}/${month}`)
const getDashboardCATDetail = (body) => api.post('/transaction/dashboard/get_dashboard_cat_detail', body) const getDashboardCATDetail = (body) => api.post('/transaction/dashboard/get_dashboard_cat_detail', body)
const getHierarkiReportYtd = (body) => api.post('/transaction/summary_ytd/summary/get_report_hierarki', body) const getHierarkiReportYtd = (body) => api.post('/transaction/summary_ytd/summary/get_report_hierarki', body)
const getHierarkiReportHistorical = (body) => api.post('/transaction/summary_historical/summary/get_report_hierarki', body) const getHierarkiReportHistorical = (body) => api.post('/transaction/summary_historical/summary/get_report_hierarki', body)
...@@ -334,7 +334,7 @@ const create = (type = "") => { ...@@ -334,7 +334,7 @@ const create = (type = "") => {
const getDashboardFinancial = (body) => api.post('/transaction/dashboard/get_dashboard_financial', body) const getDashboardFinancial = (body) => api.post('/transaction/dashboard/get_dashboard_financial', body)
const getReportCATPA = (body) => api.post('/transaction/cat/performance_appraisal', body) const getReportCATPA = (body) => api.post('/transaction/cat/performance_appraisal', body)
const getReportCATPQ = (body) => api.post('/transaction/cat/quarterly/get_report_hierarki', body) const getReportCATPQ = (body) => api.post('/transaction/cat/quarterly/get_report_hierarki', body)
//CASH FLOW //CASH FLOW
const getDetailReportCF = (body) => api.post('/transaction/cash_flow/master_budget/get_report_hierarki', body) const getDetailReportCF = (body) => api.post('/transaction/cash_flow/master_budget/get_report_hierarki', body)
const createReportCF = (body) => api.post('transaction/cash_flow/master_budget/create_submission_report', body) const createReportCF = (body) => api.post('transaction/cash_flow/master_budget/create_submission_report', body)
...@@ -361,7 +361,7 @@ const create = (type = "") => { ...@@ -361,7 +361,7 @@ const create = (type = "") => {
const checkApproverOLPA = () => api.get('transaction/outlook_pa/is_approver') const checkApproverOLPA = () => api.get('transaction/outlook_pa/is_approver')
const createPeriodeRevisionOLPA = (body) => api.post('transaction/outlook_pa/create_periode_revision', body) const createPeriodeRevisionOLPA = (body) => api.post('transaction/outlook_pa/create_periode_revision', body)
const getHierarkiCFOLPA = (body) => api.post('transaction/cash_flow/outlook_pa/get_report_hierarki', body) const getHierarkiCFOLPA = (body) => api.post('transaction/cash_flow/outlook_pa/get_report_hierarki', body)
const createCFOLPA = (body) => api.post ('transaction/cash_flow/outlook_pa/create_outlook_report', body) const createCFOLPA = (body) => api.post('transaction/cash_flow/outlook_pa/create_outlook_report', body)
const getHierarkiDBPLOLPA = (body) => api.post('transaction/db_profit_loss/outlook_pa/get_report_hierarki', body) const getHierarkiDBPLOLPA = (body) => api.post('transaction/db_profit_loss/outlook_pa/get_report_hierarki', body)
const createDBPLOLPA = (body) => api.post('transaction/db_profit_loss/outlook_pa/create_outlook_report', body) const createDBPLOLPA = (body) => api.post('transaction/db_profit_loss/outlook_pa/create_outlook_report', body)
const getHierarkiDBPLRO = (body) => api.post('transaction/db_profit_loss/rolling_outlook/get_report_hierarki', body) const getHierarkiDBPLRO = (body) => api.post('transaction/db_profit_loss/rolling_outlook/get_report_hierarki', body)
...@@ -427,10 +427,10 @@ const create = (type = "") => { ...@@ -427,10 +427,10 @@ const create = (type = "") => {
const uploadMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/import_monthly_report', body) const uploadMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/import_monthly_report', body)
const validateSubmitReportOI = (body) => api.post('transaction/operating_indicator/monthly_report/validate_save', body) const validateSubmitReportOI = (body) => api.post('transaction/operating_indicator/monthly_report/validate_save', body)
const validateSubmitReportFAM = (body) => api.post('transaction/fam/monthly_report/validate_save', body) const validateSubmitReportFAM = (body) => api.post('transaction/fam/monthly_report/validate_save', body)
const getListUserSubcoMB = (periode) => api.get(`transaction/get_dashboard_sub_co/master_budget/${periode}`) const getListUserSubcoMB = (periode) => api.get(`transaction/get_dashboard_sub_co/master_budget/${periode}`)
const getListUserSubcoMR = (months,periode) => api.get(`transaction/get_dashboard_sub_co/monthly_report/${periode}/${months}`) const getListUserSubcoMR = (months, periode) => api.get(`transaction/get_dashboard_sub_co/monthly_report/${periode}/${months}`)
const getListUserSubcoRO = (periode,quartal) => api.get(`transaction/get_dashboard_sub_co/rolling_outlook/${periode}/${quartal}`) const getListUserSubcoRO = (periode, quartal) => api.get(`transaction/get_dashboard_sub_co/rolling_outlook/${periode}/${quartal}`)
const getListUserSubcoOL = (periode) => api.get(`transaction/get_dashboard_sub_co/outlook_pa/${periode}`) const getListUserSubcoOL = (periode) => api.get(`transaction/get_dashboard_sub_co/outlook_pa/${periode}`)
// Cronjob // Cronjob
...@@ -440,11 +440,15 @@ const create = (type = "") => { ...@@ -440,11 +440,15 @@ const create = (type = "") => {
const getHierarkiCronJobMRPL = () => api.get('/transaction/report/get_hierarki_monthly_report/profit_loss') const getHierarkiCronJobMRPL = () => api.get('/transaction/report/get_hierarki_monthly_report/profit_loss')
const getHierarkiCronJobMRCF = () => api.get('/transaction/report/get_hierarki_monthly_report/cash_flow') const getHierarkiCronJobMRCF = () => api.get('/transaction/report/get_hierarki_monthly_report/cash_flow')
const getHierarkiCronJobMRRatio = () => api.get('/transaction/report/get_hierarki_monthly_report/ratio') const getHierarkiCronJobMRRatio = () => api.get('/transaction/report/get_hierarki_monthly_report/ratio')
// Ratio X LOCF // Ratio X LOCF
const getRatioLOCF = (body) => api.get(`/transaction/cronjob/create_monthly_report/${body.report}/${body.monthlyReportId}/${body.companyId}/${body.months}/${body.periode}`) const getRatioLOCF = (body) => api.get(`/transaction/cronjob/create_monthly_report/${body.report}/${body.monthlyReportId}/${body.companyId}/${body.months}/${body.periode}`)
const triggerRatioFromLOCF = (body) => api.get(`/transaction/cronjob/create_monthly_report_locf/${body.report}/${body.monthlyReportId}/${body.companyId}/${body.months}/${body.periode}`) const triggerRatioFromLOCF = (body) => api.get(`/transaction/cronjob/create_monthly_report_locf/${body.report}/${body.monthlyReportId}/${body.companyId}/${body.months}/${body.periode}`)
const triggerRatioMB = (body) => api.get(`/transaction/cronjob/create_master_budget_company/${body.report}/${body.submissionId}/${body.companyId}/${body.periode}`)
const triggerRatioRO = (body) => api.get(`/transaction/cronjob/create_rolling_outlook_company/${body.report}/${body.rollingOutlookId}/${body.companyId}/${body.quartal}/${body.periode}`)
const triggerRatioOLPA = (body) => api.get(`/transaction/cronjob/create_outlook_pa_company/${body.report}/${body.outlookPaId}/${body.companyId}/${body.periode}`)
// MonthlyPL // MonthlyPL
// const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body) // const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
// const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body) // const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body)
...@@ -480,7 +484,7 @@ const create = (type = "") => { ...@@ -480,7 +484,7 @@ const create = (type = "") => {
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 // Superadmin Approve
const getListApprover = (report,monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`) const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`)
const getIdToken = (userId) => api.get(`transaction/get_token/${userId}`) const getIdToken = (userId) => api.get(`transaction/get_token/${userId}`)
// ------ // ------
// STEP 3 // STEP 3
...@@ -823,6 +827,9 @@ const create = (type = "") => { ...@@ -823,6 +827,9 @@ const create = (type = "") => {
createCATOLPA, createCATOLPA,
getRatioLOCF, getRatioLOCF,
triggerRatioFromLOCF, triggerRatioFromLOCF,
triggerRatioMB,
triggerRatioRO,
triggerRatioOLPA,
getMonitoringMB, getMonitoringMB,
getMonitoringMR, getMonitoringMR,
getMonitoringRO, getMonitoringRO,
......
...@@ -534,7 +534,7 @@ export default class BudgetTahunan extends Component { ...@@ -534,7 +534,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.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : (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 => {
...@@ -558,24 +558,35 @@ export default class BudgetTahunan extends Component { ...@@ -558,24 +558,35 @@ export default class BudgetTahunan extends Component {
// this.getPL(type) // this.getPL(type)
if (this.state.isAdmin) { if (this.state.isAdmin) {
console.log('masuk') console.log('masuk')
api.create().getListApprover('master_budget',this.state.submissionID).then((response) => { api.create().getListApprover('master_budget', this.state.submissionID).then((response) => {
console.log(response) console.log(response)
if (response.data.data) { if (response.data.data) {
let dataListApprover = [] let dataListApprover = []
response.data.data.map((item,index) => { response.data.data.map((item, index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname}) dataListApprover.push({ userId: item.user_id, fullname: item.fullname })
}) })
let defaultProps = { let defaultProps = {
options: dataListApprover, options: dataListApprover,
getOptionLabel: (option) => option.fullname, getOptionLabel: (option) => option.fullname,
}; };
this.setState({listApprover: defaultProps}) 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)
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
"submissionId": this.state.submissionID,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id
}
api.create().triggerRatioMB(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -2050,9 +2061,9 @@ export default class BudgetTahunan extends Component { ...@@ -2050,9 +2061,9 @@ export default class BudgetTahunan extends Component {
console.log(res) console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (this.state.isAdmin && type == 'approve') { if (this.state.isAdmin && type == 'approve') {
localStorage.setItem(Constant.TOKEN, realToken) localStorage.setItem(Constant.TOKEN, realToken)
this.setState({visibleApproveSuperadmin: false}) this.setState({ visibleApproveSuperadmin: false })
} }
setTimeout(() => { setTimeout(() => {
if (type == 'revision') { if (type == 'revision') {
......
...@@ -266,6 +266,16 @@ export default class BalanceSheet extends Component { ...@@ -266,6 +266,16 @@ export default class BalanceSheet extends Component {
this.setState({ loading: false }) this.setState({ loading: false })
if (type == 'submitted') { if (type == 'submitted') {
this.props.saveToMasterBudget(payload, 'BS') this.props.saveToMasterBudget(payload, 'BS')
let bodyRatioBs = {
"report": 'ratio',
"submissionId": this.props.submissionID,
"periode": this.props.periode,
"companyId": this.props.company.company_id
}
api.create().triggerRatioMB(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
} }
...@@ -437,6 +447,16 @@ export default class BalanceSheet extends Component { ...@@ -437,6 +447,16 @@ export default class BalanceSheet extends Component {
this.props.onClickClose() this.props.onClickClose()
if (type == 'submitted') { if (type == 'submitted') {
this.props.getReport('BS') this.props.getReport('BS')
let bodyRatioBs = {
"report": 'ratio',
"submissionId": this.props.submissionID,
"periode": this.props.periode,
"companyId": this.props.company.company_id
}
api.create().triggerRatioMB(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
this.props.getReport() this.props.getReport()
} }
...@@ -989,7 +1009,7 @@ export default class BalanceSheet extends Component { ...@@ -989,7 +1009,7 @@ export default class BalanceSheet extends Component {
thousandSeparator={true} thousandSeparator={true}
style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? '#5198ea' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? '#5198ea' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
...@@ -1007,10 +1027,10 @@ export default class BalanceSheet extends Component { ...@@ -1007,10 +1027,10 @@ export default class BalanceSheet extends Component {
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)} value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 'r/e') handleChange(event.target.value, tableMeta, 'r/e')
// console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
null null
...@@ -3503,7 +3523,7 @@ export default class BalanceSheet extends Component { ...@@ -3503,7 +3523,7 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
) )
}) : }) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
} }
</div> </div>
</div> </div>
......
...@@ -609,7 +609,7 @@ export default class MonthlyReport extends Component { ...@@ -609,7 +609,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.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : 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 => {
...@@ -631,18 +631,18 @@ export default class MonthlyReport extends Component { ...@@ -631,18 +631,18 @@ export default class MonthlyReport extends Component {
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (this.state.isAdmin) { if (this.state.isAdmin) {
console.log('masuk') console.log('masuk')
api.create().getListApprover('monthly_report',this.state.monthlyReportId).then((response) => { api.create().getListApprover('monthly_report', this.state.monthlyReportId).then((response) => {
console.log(response) console.log(response)
if (response.data.data) { if (response.data.data) {
let dataListApprover = [] let dataListApprover = []
response.data.data.map((item,index) => { response.data.data.map((item, index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname}) dataListApprover.push({ userId: item.user_id, fullname: item.fullname })
}) })
let defaultProps = { let defaultProps = {
options: dataListApprover, options: dataListApprover,
getOptionLabel: (option) => option.fullname, getOptionLabel: (option) => option.fullname,
}; };
this.setState({listApprover: defaultProps}) this.setState({ listApprover: defaultProps })
} }
}) })
} }
...@@ -661,6 +661,18 @@ export default class MonthlyReport extends Component { ...@@ -661,6 +661,18 @@ export default class MonthlyReport extends Component {
console.log(res) console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
}) })
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
}
api.create().triggerRatioFromLOCF(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -1085,9 +1097,9 @@ export default class MonthlyReport extends Component { ...@@ -1085,9 +1097,9 @@ export default class MonthlyReport extends Component {
console.log(res) console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (this.state.isAdmin && type == 'approve') { if (this.state.isAdmin && type == 'approve') {
localStorage.setItem(Constant.TOKEN, realToken) localStorage.setItem(Constant.TOKEN, realToken)
this.setState({visibleApproveSuperadmin: false}) this.setState({ visibleApproveSuperadmin: false })
} }
setTimeout(() => { setTimeout(() => {
if (type == 'revision') { if (type == 'revision') {
...@@ -2789,7 +2801,7 @@ export default class MonthlyReport extends Component { ...@@ -2789,7 +2801,7 @@ export default class MonthlyReport extends Component {
</div> </div>
</div> </div>
: :
this.state.isAdmin && (this.state.lastStatus == 'WAITING FOR YOUR APPROVAL' || this.state.lastStatus == 'WAITING FOR APPROVAL')? this.state.isAdmin && (this.state.lastStatus == 'WAITING FOR YOUR APPROVAL' || this.state.lastStatus == 'WAITING FOR APPROVAL') ?
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}> <div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
<div className="col-1" /> <div className="col-1" />
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
...@@ -3269,7 +3281,7 @@ export default class MonthlyReport extends Component { ...@@ -3269,7 +3281,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.setHeaderTokenSuperadmin('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>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -470,7 +470,7 @@ export default class OutlookPA extends Component { ...@@ -470,7 +470,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.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : 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)
...@@ -487,18 +487,18 @@ export default class OutlookPA extends Component { ...@@ -487,18 +487,18 @@ export default class OutlookPA extends Component {
// console.log(this.state.lastStatus); // console.log(this.state.lastStatus);
if (this.state.isAdmin) { if (this.state.isAdmin) {
console.log('masuk') console.log('masuk')
api.create().getListApprover('outlook_pa',this.state.outlook_pa_id).then((response) => { api.create().getListApprover('outlook_pa', this.state.outlook_pa_id).then((response) => {
console.log(response) console.log(response)
if (response.data.data) { if (response.data.data) {
let dataListApprover = [] let dataListApprover = []
response.data.data.map((item,index) => { response.data.data.map((item, index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname}) dataListApprover.push({ userId: item.user_id, fullname: item.fullname })
}) })
let defaultProps = { let defaultProps = {
options: dataListApprover, options: dataListApprover,
getOptionLabel: (option) => option.fullname, getOptionLabel: (option) => option.fullname,
}; };
this.setState({listApprover: defaultProps}) this.setState({ listApprover: defaultProps })
} }
}) })
} }
...@@ -507,6 +507,17 @@ export default class OutlookPA extends Component { ...@@ -507,6 +507,17 @@ export default class OutlookPA extends Component {
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
// this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type) this.getPL(type)
} else if (type != undefined && type == 'BS') {
let bodyRatioOLPA = {
"report": 'ratio',
"outlookPaId": this.state.outlook_pa_id,
"companyId": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -570,7 +581,7 @@ export default class OutlookPA extends Component { ...@@ -570,7 +581,7 @@ export default class OutlookPA extends Component {
approvalSubmission(type, realToken) { approvalSubmission(type, realToken) {
this.scrollToMyRef() this.scrollToMyRef()
// if (this.state.isAdmin && type == 'approve') { // 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(realToken) // // console.log(realToken)
// // console.log(response.data.data.token) // // console.log(response.data.data.token)
...@@ -604,9 +615,9 @@ export default class OutlookPA extends Component { ...@@ -604,9 +615,9 @@ export default class OutlookPA extends Component {
console.log(res) console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (this.state.isAdmin && type == 'approve') { if (this.state.isAdmin && type == 'approve') {
localStorage.setItem(Constant.TOKEN, realToken) localStorage.setItem(Constant.TOKEN, realToken)
this.setState({visibleApproveSuperadmin: false}) this.setState({ visibleApproveSuperadmin: false })
} }
setTimeout(() => { setTimeout(() => {
if (type == 'revision') { if (type == 'revision') {
...@@ -1351,7 +1362,7 @@ export default class OutlookPA extends Component { ...@@ -1351,7 +1362,7 @@ export default class OutlookPA extends Component {
} }
handleApproveAdmin() { handleApproveAdmin() {
this.setState({visibleApproveSuperadmin: true}) this.setState({ visibleApproveSuperadmin: true })
} }
render() { render() {
...@@ -2207,7 +2218,7 @@ export default class OutlookPA extends Component { ...@@ -2207,7 +2218,7 @@ export default class OutlookPA extends Component {
</div> </div>
)} )}
{this.state.visibleApproveSuperadmin && ( {this.state.visibleApproveSuperadmin && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <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="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
...@@ -2257,7 +2268,7 @@ export default class OutlookPA extends Component { ...@@ -2257,7 +2268,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.setHeaderTokenSuperadmin('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>
......
...@@ -325,8 +325,24 @@ export default class BalanceSheetOLPA extends Component { ...@@ -325,8 +325,24 @@ export default class BalanceSheetOLPA extends Component {
} }
console.log(data); console.log(data);
this.setState({ loading: false }) this.setState({ loading: false })
this.props.saveToOLPA(payload) if (type == 'submitted') {
this.props.onClickClose() this.props.saveToOLPA(payload)
let bodyRatioOLPA = {
"report": 'ratio',
"outlookPaId": this.props.outlook_pa_id,
"companyId": this.props.company.company_id,
"periode": this.props.periode
}
api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
console.log(res)
this.setState({ loading: false })
})
this.props.onClickClose()
} else {
this.props.saveToOLPA(payload)
this.props.onClickClose()
}
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -484,8 +500,23 @@ export default class BalanceSheetOLPA extends Component { ...@@ -484,8 +500,23 @@ export default class BalanceSheetOLPA extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() if (type == 'submitted') {
this.props.getReport() this.props.onClickClose()
this.props.getReport()
let bodyRatioOLPA = {
"report": 'ratio',
"outlookPaId": this.props.outlook_pa_id,
"companyId": this.props.company.company_id,
"periode": this.props.periode
}
api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
this.props.onClickClose()
this.props.getReport()
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......
...@@ -529,7 +529,7 @@ export default class RollingOutlook extends Component { ...@@ -529,7 +529,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.isAdmin && this.state.lastStatus == 'WAITING FOR APPROVAL'? false : 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 => {
...@@ -552,18 +552,18 @@ export default class RollingOutlook extends Component { ...@@ -552,18 +552,18 @@ export default class RollingOutlook extends Component {
console.log(this.state.lastStatus); console.log(this.state.lastStatus);
if (this.state.isAdmin) { if (this.state.isAdmin) {
console.log('masuk') console.log('masuk')
api.create().getListApprover('rolling_outlook',this.state.rollingOutlookID).then((response) => { api.create().getListApprover('rolling_outlook', this.state.rollingOutlookID).then((response) => {
console.log(response) console.log(response)
if (response.data.data) { if (response.data.data) {
let dataListApprover = [] let dataListApprover = []
response.data.data.map((item,index) => { response.data.data.map((item, index) => {
dataListApprover.push({userId: item.user_id, fullname: item.fullname}) dataListApprover.push({ userId: item.user_id, fullname: item.fullname })
}) })
let defaultProps = { let defaultProps = {
options: dataListApprover, options: dataListApprover,
getOptionLabel: (option) => option.fullname, getOptionLabel: (option) => option.fullname,
}; };
this.setState({listApprover: defaultProps}) this.setState({ listApprover: defaultProps })
} }
}) })
} }
...@@ -572,6 +572,18 @@ export default class RollingOutlook extends Component { ...@@ -572,6 +572,18 @@ export default class RollingOutlook extends Component {
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
// this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type) this.getPL(type)
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
"rollingOutlookId": this.state.rollingOutlookID,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"quartal": this.state.quarter.value
}
api.create().triggerRatioRO(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -674,9 +686,9 @@ export default class RollingOutlook extends Component { ...@@ -674,9 +686,9 @@ export default class RollingOutlook extends Component {
console.log(res) console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (this.state.isAdmin && type == 'approve') { if (this.state.isAdmin && type == 'approve') {
localStorage.setItem(Constant.TOKEN, realToken) localStorage.setItem(Constant.TOKEN, realToken)
this.setState({visibleApproveSuperadmin: false}) this.setState({ visibleApproveSuperadmin: false })
} }
setTimeout(() => { setTimeout(() => {
if (type == 'revision') { if (type == 'revision') {
......
...@@ -372,8 +372,24 @@ export default class BalanceSheetRO extends Component { ...@@ -372,8 +372,24 @@ export default class BalanceSheetRO extends Component {
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() if (type == 'submitted') {
this.props.refresh() this.props.onClickClose()
this.props.refresh()
let bodyRatioRO = {
"report": 'ratio',
"rollingOutlookId": this.props.rollingOutlookID,
"periode": this.props.periode,
"companyId": this.props.company.company_id,
"quartal": this.props.quarter
}
api.create().triggerRatioRO(bodyRatioRO).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
this.props.onClickClose()
this.props.refresh()
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
...@@ -582,8 +598,24 @@ export default class BalanceSheetRO extends Component { ...@@ -582,8 +598,24 @@ export default class BalanceSheetRO extends Component {
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() if (type == 'submitted') {
this.props.refresh() this.props.onClickClose()
this.props.refresh()
let bodyRatioRO = {
"report": 'ratio',
"rollingOutlookId": this.props.rollingOutlookID,
"periode": this.props.periode,
"companyId": this.props.company.company_id,
"quartal": this.props.quarter
}
api.create().triggerRatioRO(bodyRatioRO).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
this.props.onClickClose()
this.props.refresh()
}
} else { } else {
this.setState({ loading: false, handleTekTekTek: 0 }, () => { this.setState({ loading: false, handleTekTekTek: 0 }, () => {
// this.props.saveToMonthlyReport() // this.props.saveToMonthlyReport()
...@@ -2346,7 +2378,7 @@ export default class BalanceSheetRO extends Component { ...@@ -2346,7 +2378,7 @@ export default class BalanceSheetRO extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)} value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
// value={Number(val).toFixed(1)} // value={Number(val).toFixed(1)}
/> />
} }
/> />
......
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