Commit 5d302b17 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Update CAT MB & RO

See merge request !1850
parents 2119bc95 13ba3087
...@@ -280,7 +280,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -280,7 +280,7 @@ export default class CorporateAnnualTarget extends Component {
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&currency_id=${this.props.defaultCurrency.id}`
) )
res = await res.blob() res = await res.blob()
// // // // console.log(res) // // // // console.log(res)
......
...@@ -338,9 +338,9 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -338,9 +338,9 @@ export default class CorporateAnnualTargetMR extends Component {
} }
downloadTemplate = async () => { downloadTemplate = async () => {
console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}`) console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}&&currency_id=${this.props.defaultCurrency.id}`)
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}&&currency_id=${this.props.defaultCurrency.id}`
) )
console.log(res); console.log(res);
res = await res.blob() res = await res.blob()
......
...@@ -2549,6 +2549,7 @@ export default class MonthlyReport extends Component { ...@@ -2549,6 +2549,7 @@ export default class MonthlyReport extends Component {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<button <button
......
...@@ -343,7 +343,7 @@ export default class CorporateAnnualTargetRO extends Component { ...@@ -343,7 +343,7 @@ export default class CorporateAnnualTargetRO extends Component {
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}&&currency_id=${this.props.defaultCurrency.id}`
) )
res = await res.blob() res = await res.blob()
if (res.size > 0) { if (res.size > 0) {
......
...@@ -96,8 +96,9 @@ export default class ProfitLossROO extends Component { ...@@ -96,8 +96,9 @@ export default class ProfitLossROO extends Component {
componentDidMount() { componentDidMount() {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
console.log(this.props);
// this.getSettingControl() // this.getSettingControl()
// this.handleViewOnly() this.handleViewOnly()
} }
handleViewOnly() { handleViewOnly() {
...@@ -409,7 +410,7 @@ export default class ProfitLossROO extends Component { ...@@ -409,7 +410,7 @@ export default class ProfitLossROO extends Component {
} }
this.props.onClickClose() this.props.onClickClose()
} else { } else {
this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
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")) {
setTimeout(() => { setTimeout(() => {
...@@ -568,7 +569,7 @@ export default class ProfitLossROO extends Component { ...@@ -568,7 +569,7 @@ export default class ProfitLossROO extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
currency_id: this.state.defaultCurrencyUpload?.id, "currency_id": this.state.defaultCurrencyUpload?.id,
"quartal": this.props.quarter, "quartal": this.props.quarter,
"rolling_outlook_id": this.props.rollingOutlookID, "rolling_outlook_id": this.props.rollingOutlookID,
"status": type, "status": type,
...@@ -589,16 +590,20 @@ export default class ProfitLossROO extends Component { ...@@ -589,16 +590,20 @@ export default class ProfitLossROO extends Component {
// this.props.onClickClose() // this.props.onClickClose()
// this.props.getReport() // this.props.getReport()
} else { } else {
this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => { if (response.data?.message == "Please Set Up Rate Currency First") {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { this.setState({ visibleAlertSave: true })
setTimeout(() => { } else {
localStorage.removeItem(Constant.TOKEN) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
window.location.reload(); if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
}, 1000); setTimeout(() => {
} localStorage.removeItem(Constant.TOKEN)
this.props.onClickClose() window.location.reload();
this.props.refresh() }, 1000);
}) }
// this.props.onClickClose()
this.props.refresh()
})
}
// alert(response.data.status) // alert(response.data.status)
} }
} else { } else {
...@@ -2374,7 +2379,7 @@ export default class ProfitLossROO extends Component { ...@@ -2374,7 +2379,7 @@ export default class ProfitLossROO extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{/* <a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2390,7 +2395,7 @@ export default class ProfitLossROO extends Component { ...@@ -2390,7 +2395,7 @@ export default class ProfitLossROO extends Component {
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */} <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> </div>
} }
</div> </div>
...@@ -2423,128 +2428,128 @@ export default class ProfitLossROO extends Component { ...@@ -2423,128 +2428,128 @@ export default class ProfitLossROO extends Component {
</div> </div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
</div> </div>
{this.props.isApprover === true || this.state.dataTable.length == 0 ? null : {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="grid grid-2x" style={{ padding: 20 }}> <div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}> <div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{this.props.isApprover === true?
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly &&
<button <button
className="button"
type="button" type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, refresh: true }, () => {
this.handleGetFor('edit')
})
}} }}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
</div> </div>
</button> </button>}
</div> {this.state.get_for == 'edit' && <button
{this.props.isApprover === true ? className="button"
<div className="col-2"> type="button"
</div> : style={{
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> backgroundColor: 'transparent',
{this.state.get_for == 'view' && this.state.viewOnly && cursor: 'pointer',
<button borderColor: 'transparent',
className="button" outline: 'none',
type="button" marginRight: 20
style={{ }}
backgroundColor: 'transparent', onClick={() => {
cursor: 'pointer', this.setState({ loading: true }, () => {
borderColor: 'transparent', setTimeout(() => {
outline: 'none', this.handleValidate()
marginRight: 20 }, 100);
}} })
onClick={() => { }}
this.setState({ loading: true, refresh: true }, () => { >
this.handleGetFor('edit') <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
}) <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
}} </div>
> </button>}
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> {this.state.get_for == 'edit' && <button
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography> className="button"
</div> type="button"
</button>} style={{
{this.state.get_for == 'edit' && <button backgroundColor: 'transparent',
className="button" cursor: 'pointer',
type="button" borderColor: 'transparent',
style={{ outline: 'none',
backgroundColor: 'transparent', marginRight: 20
cursor: 'pointer', }}
borderColor: 'transparent', onClick={() =>
outline: 'none', this.state.saveDraft === true ?
marginRight: 20 this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
}} :
onClick={() => { this.state.handleDoubleClick == 1 ? null :
this.setState({ loading: true }, () => { this.setState({ handleDoubleClick: 1, loading: true }, () => {
setTimeout(() => { this.backToRollingOutlook('draft')
this.handleValidate()
}, 100);
}) })
}} }
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.backToRollingOutlook('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.backToRollingOutlook('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete3</Typography>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div>
</button>}
</div> </div>
} </button>}
{this.state.get_for == 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.backToRollingOutlook('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete3</Typography>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div>
</button>}
</div> </div>
: null }
} </div>
{/* : null
} */}
</Paper> </Paper>
: :
<Paper style={{ paddingTop: 10 }}> <Paper style={{ paddingTop: 10 }}>
......
...@@ -672,7 +672,7 @@ export default class RollingOutlook extends Component { ...@@ -672,7 +672,7 @@ export default class RollingOutlook extends Component {
} }
api.create().getRollingOutlookIsApprover().then(response => { api.create().getRollingOutlookIsApprover().then(response => {
// console.log(response); console.log(response);
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }) this.setState({ isApprover: true, checkApprover: true })
} else { } else {
...@@ -1722,6 +1722,7 @@ export default class RollingOutlook extends Component { ...@@ -1722,6 +1722,7 @@ export default class RollingOutlook extends Component {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
// console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<button <button
......
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