Commit 744897b7 authored by Riri Novita's avatar Riri Novita

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

tes

See merge request !1684
parents c9ecce3b c2896c61
......@@ -496,6 +496,13 @@ const create = (type = "") => {
// Reminder Manual
const sendEmail = (body) => api.post('transaction/monitoring/reminder_progress_report', body)
// Download Report
const createDownloadFile = (body) => api.post('transaction/create/download-files-report', body)
const createZipReport = (id) => api.get(`transaction/zip-files?downloadedFileReportId=${id}`)
const getListDownload = () => api.get('transaction/download-files')
const downloadZipReport = (id) => api.get(`transaction/download/zip-files?downloadedFileReportId=${id}`)
// const createZipReport = (body) => api.post('transaction/monthly_report/export_selected_report', body)
// Superadmin Approve
const getListApprover = (report, monthlyReportId) => api.get(`transaction/${report}/get_approver/${monthlyReportId}`)
const getIdToken = (userId) => api.get(`transaction/get_token/${userId}`)
......@@ -855,7 +862,11 @@ const create = (type = "") => {
triggerHistoricalRatio,
getDetailMaintenanceMode,
createMaintenanceMode,
updateMaintenanceMode
updateMaintenanceMode,
createZipReport,
createDownloadFile,
getListDownload,
downloadZipReport
}
}
......
......@@ -55,7 +55,7 @@ const Images = {
dotDone: require('./dot-done.svg'),
dotOverdue: require('./dot-overdue.svg'),
dotOpen: require('./dot-open.svg'),
zip: require('./zip.png'),
}
export default Images
\ No newline at end of file
......@@ -97,6 +97,7 @@ class Login extends Component {
"password": this.state.password
}
api.create().login(payload).then((response) => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......
......@@ -20,6 +20,8 @@ import CashFlow from './CashFlow';
import { DatePicker } from '@material-ui/pickers';
import moment from 'moment';
import * as R from 'ramda'
import { PhotoSizeSelectLargeTwoTone, ThreeSixty } from '@material-ui/icons';
import { startTransition } from 'react';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -91,7 +93,10 @@ export default class BudgetTahunan extends Component {
approver: null,
isAdmin: false,
selectReport: [],
isCheckAll: false
isCheckAll: false,
downloadedFileReportId: null,
arrayReport: [],
popupDownload: false
}
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this);
......@@ -396,7 +401,7 @@ export default class BudgetTahunan extends Component {
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
// // // console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
......@@ -2358,17 +2363,14 @@ export default class BudgetTahunan extends Component {
if (this.state.isCheckAll) {
let checkAll = []
this.setState({ selectReport: checkAll, isCheckAll: false })
console.log(checkAll);
} else {
let checkAll = this.state.selectReport
data.map((item) => {
// console.log(item[4]);
if (!this.state.selectReport.includes(item[4])) {
checkAll.push(item[4])
}
})
this.setState({ selectReport: checkAll, isCheckAll: true })
console.log(checkAll);
}
}
......@@ -2378,7 +2380,6 @@ export default class BudgetTahunan extends Component {
}
handleItemClick(item) {
console.log(item);
let indexID = this.state.selectReport.findIndex((val) => val === item.rowData[4])
let selectReport = this.state.selectReport
if (indexID === -1) {
......@@ -2386,20 +2387,158 @@ export default class BudgetTahunan extends Component {
} else {
selectReport.splice(indexID, 1)
}
console.log(selectReport)
let isCheckAll = selectReport.length === this.state.dataTable.length
this.setState({ selectReport, isCheckAll })
console.log(selectReport);
}
handleDownloadReport(tableMeta) {
let { selectReport, company, periode, month } = this.state
let payload = {
"company_id": company.company_id,
"year": periode.periode,
"report_id": selectReport,
"type_report_name": "Master Budget"
}
console.log(payload);
api.create().createDownloadFile(payload).then((response) => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
this.setState({ downloadedFileReportId: data.downloadedFileReportId, popupDownload: true }, () => this.handleGenerateReport(tableMeta))
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error'})
alert(response.problem)
}
})
}
componentDidUpdate = (prevProps, prevState) => {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
setTimeout(() => {
this.handleZip()
}, 200);
}
}
handleGenerateReport(data) {
let { selectReport, submissionID, company, periode, month, downloadedFileReportId } = this.state
let a = []
if (selectReport.length > 0) {
selectReport.map(async (items) => {
if (items === 1) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 5) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 2) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 3) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 6) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 4) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID === null ? "" : submissionID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
}
handleDownloadReport() {
if (this.state.selectReport.length > 0) {
alert("Coming Soon!")
})
} else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
}
}
async handleZip() {
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ arrayReport: [] })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error'})
alert(response.problem)
}
})
}
render() {
const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
......@@ -2784,7 +2923,7 @@ export default class BudgetTahunan extends Component {
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.handleDownloadReport()}
onClick={() => this.handleDownloadReport(this.state.dataTable)}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
......@@ -3423,6 +3562,35 @@ export default class BudgetTahunan extends Component {
</div>
</div>
)}
{this.state.popupDownload && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Master Budget {this.state.company.company_name} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 3
}}
onClick={() => this.setState({ popupDownload: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div >
);
}
......
import React, { Component, useRef } from 'react';
import { Typography, Paper, TextField, Snackbar, withStyles, Switch, FormControlLabel } from '@material-ui/core';
import Images from '../../assets/Images';
import Constant from '../../library/Constant';
import api from '../../api';
import { PropagateLoader } from 'react-spinners';
import { format } from 'date-fns';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { Alert } from '@material-ui/lab';
import ReactTooltip from "react-tooltip";
import SunEditor, { buttonList } from "suneditor-react";
import 'suneditor/dist/css/suneditor.min.css'; // Import Sun Editor's CSS File
import CloudDownloadIcon from '@material-ui/icons/CloudDownload';
import moment from 'moment';
const IOSSwitch = withStyles((theme) => ({
root: {
width: 55,
height: 31,
padding: 0,
margin: theme.spacing(1),
},
switchBase: {
padding: 3,
marginLeft: 1,
'&$checked': {
transform: 'translateX(16px)',
color: theme.palette.common.white,
paddingLeft: 11,
'& + $track': {
backgroundColor: '#52d869',
opacity: 1,
border: 'none',
},
},
'&$focusVisible $thumb': {
color: '#52d869',
border: '6px solid #fff',
},
},
thumb: {
width: 25,
height: 25,
},
track: {
borderRadius: 30 / 2,
border: `1px solid ${theme.palette.grey[400]}`,
backgroundColor: 'red',
opacity: 1,
transition: theme.transitions.create(['background-color', 'border']),
},
checked: {},
focusVisible: {},
}))(({ classes, ...props }) => {
return (
<Switch
focusVisibleClassName={classes.focusVisible}
disableRipple
classes={{
root: classes.root,
switchBase: classes.switchBase,
thumb: classes.thumb,
track: classes.track,
checked: classes.checked,
}}
{...props}
/>
);
});
class DownloadReport extends Component {
constructor(props) {
super(props)
this.editorRef = React.createRef();
this.editorRefEmail = React.createRef();
// this.handleChange = this.handleChange.bind(this)
this.state = {
load: false,
loading: false,
listDownload: [],
arrayToday: []
}
}
componentDidMount() {
// const interval = setInterval(() => {
// console.log(props.idTab);
// getDataTable()
this.getListDownload()
// }, 500);
// return () => clearInterval(interval);
}
getListDownload() {
api.create().getListDownload().then((response) => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
let tudey = []
let maren = []
data.map((item) => {
var reference = moment(item.created_at).format('YYYY-MM-DD');
var today = moment().subtract(0, "days").format("YYYY-MM-DD");
var yesterday = moment().subtract(1, "days").format("YYYY-MM-DD");
if (reference === today) {
tudey.push({
data
})
console.log(tudey);
} else if (reference === today) {
maren.push({
data
})
console.log(maren);
}
})
this.setState({ listDownload: data })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
async handleDownload(idFile, type) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/download/zip-files?downloadedFileReportId=${idFile}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/download/zip-files?downloadedFileReportId=${idFile}`
)
console.log(type);
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = type.includes("Monthly Report") ? 'Monthly Report.zip' : type.includes("Master Budget") ? 'Master Budget.zip' : null;
a.click();
}
}
render() {
let { listDownload, messageAlert } = this.state
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8', minHeight: this.props.height, boxShadow: 'none' }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{messageAlert}
</Alert>
</Snackbar>
<div>
{this.state.loading && loadingComponent}
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Download Report</Typography>
</div>
{listDownload.length > 0 ?
<div style={{ padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, minHeight: this.props.height, paddingBottom: 50, background: '#d9d9d91c' }}>
<div style={{ margin: '40px 100px', background: '#fff', borderRadius: 10, minHeight: this.props.height, padding: 45 }}>
<div style={{ fontSize: 18, fontWeight: 700, color: '#273B80', marginLeft: 5, marginBottom: 10 }}>Today</div>
{this.state.listDownload.map((item) => (
item.status === 0 ?
null
:
<div style={{ display: 'flex' }}>
<div style={{ width: '7%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, marginRight: 2, borderBottomRightRadius: 0, borderTopRightRadius: 0 }}>
<div style={{ alignItems: 'center', display: 'flex' }}>
<img src={Images.zip} style={{ width: 80, margin: 9 }} />
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', height: 90, background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}>
<div>
<Typography style={{ fontSize: 18, color: '#273B80', fontWeight: 700, marginTop: 10, marginLeft: 10 }}>{item.download_file_report_name}</Typography>
<Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11 }}>Last Download by: {item.created_by} - {item.created_at}</Typography>
</div>
<div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}>
{item.status === 1 ?
<button
type="button"
disabled={true}
onClick={() => null}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#939497de', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>In Progress</Typography>
</div>
</button>
:
item.status === 2 ?
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.handleDownload(item.download_file_report_id, item.download_file_report_name)}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 140, height: 40, borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#fff', textAlign: 'center' }}>Download</Typography>
</div>
</button>
:
null
}
</div>
</div>
</div>
))}
</div>
</Paper>
</div>
:
<div style={{ flex: 1, height: '100vh', alignItems: 'center', justifyContent: 'center', display: 'flex' }}>
<div style={{ flexDirection: 'column', textAlign: 'center' }}>
<CloudDownloadIcon style={{ fontSize: 50, color: 'grey' }} />
<h3 style={{ marginTop: 5, color: 'grey' }}>
Download Report
</h3>
</div>
</div>
}
</div>
</div>
);
}
}
export default DownloadReport;
......@@ -376,7 +376,7 @@ export default function MiniDrawer() {
const getIsApprover = (superadmin) => {
api.create().getAM().then((response) => {
console.log(response);
// console.log(response);
let actAMActive = response.data.data
let userId = localStorage.getItem(Constant.USER)
let indexId = actAMActive.findIndex((val) => val.user_id == userId)
......@@ -404,7 +404,6 @@ export default function MiniDrawer() {
})
setApplication(app)
setSetting(set)
console.log(set);
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
......
......@@ -2611,27 +2611,29 @@ export default class BalanceSheetMR extends Component {
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -2661,7 +2663,7 @@ export default class BalanceSheetMR extends Component {
</button>
</a>
<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
style={{
backgroundColor: 'transparent',
......@@ -2679,7 +2681,7 @@ export default class BalanceSheetMR extends Component {
<img src={Images.download} />
</button>
</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>
......
......@@ -698,7 +698,7 @@ export default class CashFlowMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{/* <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -720,7 +720,7 @@ export default class CashFlowMR extends Component {
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
</div>
</div> */}
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
......
......@@ -2004,7 +2004,7 @@ export default class CorporateAnnualTargetMR extends Component {
</button>
</a>}
<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
style={{
backgroundColor: 'transparent',
......@@ -2022,7 +2022,7 @@ export default class CorporateAnnualTargetMR extends Component {
<img src={Images.download} />
</button>
</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>
......
......@@ -440,7 +440,7 @@ export default class FixedAssetsMovementMR extends Component {
this.props.saveToMonthlyReport()
}
} 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 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
......@@ -1015,11 +1015,11 @@ export default class FixedAssetsMovementMR extends Component {
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "beginning balance" && this.props.periode == 2021 && this.props.month.month_id == 1? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "beginning balance" && this.props.periode == 2021 && this.props.month.month_id == 1 ? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={String(tableMeta.rowData[5]).toLocaleLowerCase() == "beginning balance" && this.props.periode == 2021 && this.props.month.month_id == 1? false : true}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "beginning balance" && this.props.periode == 2021 && this.props.month.month_id == 1? Number(tableMeta.rowData[8]).toFixed(1) : Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
disabled={String(tableMeta.rowData[5]).toLocaleLowerCase() == "beginning balance" && this.props.periode == 2021 && this.props.month.month_id == 1 ? false : true}
value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "beginning balance" && this.props.periode == 2021 && this.props.month.month_id == 1 ? Number(tableMeta.rowData[8]).toFixed(1) : Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 8)
}}
......@@ -1347,27 +1347,29 @@ export default class FixedAssetsMovementMR extends Component {
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -1397,7 +1399,7 @@ export default class FixedAssetsMovementMR extends Component {
</button>
</a>
<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
style={{
backgroundColor: 'transparent',
......@@ -1415,7 +1417,7 @@ export default class FixedAssetsMovementMR extends Component {
<img src={Images.download} />
</button>
</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>
......@@ -1432,9 +1434,9 @@ export default class FixedAssetsMovementMR extends Component {
</MuiThemeProvider>
)}
</div>
<div style={{display: 'flex'}}>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10}}>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
......
......@@ -3856,7 +3856,7 @@ export default class ListOfCreditFacilities extends Component {
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
)}
<a data-tip={'Download'} data-for="download">
{/* <a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -3875,7 +3875,7 @@ export default class ListOfCreditFacilities extends Component {
<img src={Images.download} />
</button>
</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>
......
......@@ -22,6 +22,8 @@ import CashFlowMR from './CashFlowMR';
import { DatePicker } from '@material-ui/pickers';
import moment from 'moment';
import * as R from 'ramda'
import { PhotoSizeSelectLargeTwoTone, ThreeSixty } from '@material-ui/icons';
import { startTransition } from 'react';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -90,7 +92,10 @@ export default class MonthlyReport extends Component {
approver: null,
isAdmin: false,
selectReport: [],
isCheckAll: false
isCheckAll: false,
downloadedFileReportId: null,
arrayReport: [],
popupDownload: false
}
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this);
......@@ -2170,11 +2175,9 @@ export default class MonthlyReport extends Component {
}
handleSelectAll(data) {
console.log(data);
if (this.state.isCheckAll) {
let checkAll = []
this.setState({ selectReport: checkAll, isCheckAll: false })
console.log(checkAll);
} else {
let checkAll = this.state.selectReport
data.map((item) => {
......@@ -2184,7 +2187,6 @@ export default class MonthlyReport extends Component {
}
})
this.setState({ selectReport: checkAll, isCheckAll: true })
console.log(checkAll);
}
}
......@@ -2194,7 +2196,6 @@ export default class MonthlyReport extends Component {
}
handleItemClick(item) {
console.log(item);
let indexID = this.state.selectReport.findIndex((val) => val === item.rowData[4])
let selectReport = this.state.selectReport
if (indexID === -1) {
......@@ -2202,12 +2203,174 @@ export default class MonthlyReport extends Component {
} else {
selectReport.splice(indexID, 1)
}
console.log(selectReport)
let isCheckAll = selectReport.length === this.state.dataTable.length
this.setState({ selectReport, isCheckAll })
}
handleDownloadReport(tableMeta) {
let { selectReport, company, periode, month } = this.state
let payload = {
"company_id": company.company_id,
"year": periode.periode,
"report_id": selectReport,
"type_report_name": "Monthly Report"
}
console.log(payload);
api.create().createDownloadFile(payload).then((response) => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
this.setState({ downloadedFileReportId: data.downloadedFileReportId, popupDownload: true }, () => this.handleGenerateReport(tableMeta))
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error'})
alert(response.problem)
}
})
}
componentDidUpdate = (prevProps, prevState) => {
if (this.state.selectReport.length > 0 && (this.state.arrayReport.length == this.state.selectReport.length)) {
setTimeout(() => {
this.handleZip()
}, 200);
}
}
handleGenerateReport(data) {
let { selectReport, monthlyReportId, company, periode, revisionTable, month, downloadedFileReportId } = this.state
console.log(selectReport);
let a = []
if (selectReport.length > 0) {
selectReport.map(async (items) => {
if (items === 8) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
console.log(res);
} else if (items === 12) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 7) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 9) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/fam/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/fam/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 13) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 11) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else if (items === 10) {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cat/monthly_report/export_monthly_report?monthly_report_id=${monthlyReportId === null ? "" : monthlyReportId}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&months=${month.month_id}&&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
}
})
console.log(a, selectReport);
// setTimeout(() => {
// this.handleZip()
// }, 1000);
// this.setState({ popupDownload: true })
} else {
alert("Anda harus memilih report yang ingin di download terlebih dahulu!")
}
}
async handleZip() {
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ arrayReport: [] })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error'})
alert(response.problem)
}
})
}
render() {
const columns = ["#", "Report Type",
{
......@@ -2718,7 +2881,7 @@ export default class MonthlyReport extends Component {
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.handleDownloadReport()}
onClick={() => this.handleDownloadReport(this.state.dataTable)}
style={{
backgroundColor: 'transparent',
borderColor: 'transparent',
......@@ -3390,6 +3553,35 @@ export default class MonthlyReport extends Component {
</div>
</div>
)}
{this.state.popupDownload && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#D9D9D9', borderRadius: 10, width: 609, height: 276 }}>
<div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#33508B', margin: '70px 20px' }}>Monthly Report {this.state.company.company_name} {this.state.month.month_value} {this.state.periode.periode} In Progress Download, silahkan cek status di menu <b>Progress Download</b></div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 3
}}
onClick={() => this.setState({ popupDownload: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div >
);
}
......
......@@ -2032,27 +2032,29 @@ export default class ProfitLossMR extends Component {
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
null
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -2081,7 +2083,7 @@ export default class ProfitLossMR extends Component {
<img src={Images.upload} />
</button>
</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">
<button
style={{
......@@ -2100,7 +2102,7 @@ export default class ProfitLossMR extends Component {
<img src={Images.download} />
</button>
</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>
......
......@@ -56,7 +56,7 @@ export default class TaxPlanningMR extends Component {
saveDraft: true,
buttonError: true,
get_for: "view",
viewOnly : true
viewOnly: true
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -99,11 +99,11 @@ export default class TaxPlanningMR extends Component {
checkStatus = false
}
this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev})
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.setState({ get_for: type }, () => {
this.getSettingControl()
this.getLatestUpdate()
})
......@@ -361,9 +361,9 @@ export default class TaxPlanningMR extends Component {
order: i[0] === undefined ? "" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report_name: i[2] === undefined ? "" : String(i[2]).trim(),
trial_balance_commercial: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[3]).trim()),2)) :String(roundMath(Number(String(i[3]).trim()),1)),
fiscal_correction: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[4]).trim()),2)) :String(roundMath(Number(String(i[4]).trim()),1)),
trial_balance_fiscal: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[5]).trim()),2)) :String(roundMath(Number(String(i[5]).trim()),1)),
trial_balance_commercial: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[3]).trim()), 2)) : String(roundMath(Number(String(i[3]).trim()), 1)),
fiscal_correction: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[4]).trim()), 2)) : String(roundMath(Number(String(i[4]).trim()), 1)),
trial_balance_fiscal: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[5]).trim()), 2)) : String(roundMath(Number(String(i[5]).trim()), 1)),
trial_balance_fiscal_actual: "",
trial_balance_fiscal_mb: "",
})
......@@ -535,7 +535,7 @@ export default class TaxPlanningMR extends Component {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && errorContrl === false && editAble === false ) {
if (response.data.data.result && errorContrl === false && editAble === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
......@@ -618,14 +618,14 @@ export default class TaxPlanningMR extends Component {
if (tableMeta.rowData[8] == "Under payment /(Over Payment ) Income Tax Art. 29" || forecast !== undefined) {
let opgab = []
baru.map((item, index) => {
if( item.length > 1 && (item.includes("+") || item.includes("-") || item.includes("*") || item.includes("/"))){
if (item.length > 1 && (item.includes("+") || item.includes("-") || item.includes("*") || item.includes("/"))) {
opgab.push(String(item).substr(0, Number(String(item).length) - 1))
opgab.push(String(item).substr(Number(String(item).length) - 1, 1))
} else {
opgab.push(item)
}
})
if(opgab.length > 0){
if (opgab.length > 0) {
baru = opgab
}
}
......@@ -646,7 +646,7 @@ export default class TaxPlanningMR extends Component {
}
} else {
if (forecast !== undefined) {
forecast.map((item,index) => {
forecast.map((item, index) => {
if (periode == item.periode) {
totalShldBeNil += Number(item.value)
}
......@@ -754,7 +754,7 @@ export default class TaxPlanningMR extends Component {
}
})
if(simpen2 == "active") {
if (simpen2 == "active") {
if (opt == "tambah") {
total = Number(total) + Number(total2)
} else if (opt == "kurang") {
......@@ -977,7 +977,7 @@ export default class TaxPlanningMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[1] === 4 || tableMeta.rowData[1] === 1 ?
null :
this.state.get_for == 'view'?
this.state.get_for == 'view' ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1019,7 +1019,7 @@ export default class TaxPlanningMR extends Component {
style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
value={Number(value.tbc).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 0)
......@@ -1057,7 +1057,7 @@ export default class TaxPlanningMR extends Component {
{tableMeta.rowData[2] === 4 || tableMeta.rowData[2] === 1 ?
null
:
this.state.get_for == 'view'?
this.state.get_for == 'view' ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1095,9 +1095,9 @@ export default class TaxPlanningMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.isApprover || this.state.get_for == 'view'? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
placeholder="input"
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
onBlur={(event) => {
......@@ -1135,7 +1135,7 @@ export default class TaxPlanningMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null :
this.state.get_for == 'view'?
this.state.get_for == 'view' ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1173,9 +1173,9 @@ export default class TaxPlanningMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.isApprover || this.state.get_for == 'view'? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
placeholder="input"
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
onBlur={(event) => {
......@@ -1223,7 +1223,7 @@ export default class TaxPlanningMR extends Component {
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})` } arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1268,10 +1268,10 @@ export default class TaxPlanningMR extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 || tableMeta.rowData[3] === 7?
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 || tableMeta.rowData[3] === 7 ?
null
:
this.state.get_for == 'view'?
this.state.get_for == 'view' ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1383,7 +1383,7 @@ export default class TaxPlanningMR extends Component {
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 || tableMeta.rowData[3] === 7 ?
null
:
this.state.get_for == 'view'?
this.state.get_for == 'view' ?
// Number(value).toFixed(1)
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1504,28 +1504,30 @@ export default class TaxPlanningMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view'?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
{this.props.isApprover === true || this.state.get_for == 'view' ?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -1555,7 +1557,7 @@ export default class TaxPlanningMR extends Component {
</button>
</a>
<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
style={{
backgroundColor: 'transparent',
......@@ -1573,7 +1575,7 @@ export default class TaxPlanningMR extends Component {
<img src={Images.download} />
</button>
</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>
......@@ -1590,9 +1592,9 @@ export default class TaxPlanningMR extends Component {
</MuiThemeProvider>}
{/* )} */}
</div>
<div style={{display: 'flex'}}>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10}}>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
......@@ -1644,7 +1646,7 @@ export default class TaxPlanningMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({loading: true}, () => {
this.setState({ loading: true }, () => {
this.handleGetFor('edit')
})
}}
......@@ -1663,8 +1665,7 @@ export default class TaxPlanningMR extends Component {
outline: 'none',
marginRight: 20
}}
onClick={() =>
{
onClick={() => {
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => {
// this.setState({ loading: false, buttonError: false, editable: true })
......
......@@ -149,7 +149,13 @@ const arraySide = [
path: '',
},
]
}
},
{
img: Images.outlookperformance,
label: 'Download Files',
path: 'download-files',
subItem: null
},
]
export default arraySide;
\ No newline at end of file
......@@ -24,6 +24,7 @@ import MaintenanceMode from '../container/GeneralSetting/MaintenanceMode';
import CafrmDocument from "../container/CAFRM/CafrmDocument";
import ReportCafrm from "../container/ReportCarfm/RepotrCafrm";
import Maintenance from "../container/Auth/Maintenance";
import DownloadReport from "../container/DownloadReport/DownloadReport"
const routes = [
{
......@@ -134,6 +135,10 @@ const routes = [
path: "/home/maintenance-mode",
main: MaintenanceMode
},
{
path: "/home/download-files",
main: DownloadReport
},
{
path: "*",
main: screen404
......
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