Commit 69116191 authored by Riri Novita's avatar Riri Novita

fixsying isyuu

parent 6c172b97
.main-color{
/* .main-color{
background-color: #273b80 !important;
} */
.main-color{
background-color: #1474CA !important;
}
.sub-color{
......@@ -2452,14 +2452,30 @@ export default class BudgetTahunan extends Component {
selectReport.map(async (items) => {
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}`
if (items === 6) {
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=${submissionID}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&report_id=${report[4]}&&download_file_report_id=${downloadedFileReportId}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&report_id=${report[4]}&&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}`
this.props.submissionID == null ? resNull : resReal
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
} else {
let resReal = `${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 resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&download_file_report_id=${downloadedFileReportId}`
let res = await fetch(
this.props.submissionID == null ? resNull : resReal
)
console.log(res);
if (res.status === 200) {
this.setState({ arrayReport: [...this.state.arrayReport, items] })
}
}
// if (items === 1) {
// let datas = data.findIndex((val) => val[4] == items)
// let report = data[datas]
......
import React, { Component, useRef } from 'react';
import { Typography, Paper, TextField, Snackbar, withStyles, Switch, FormControlLabel } from '@material-ui/core';
import { Typography, Paper, TextField, Snackbar, withStyles, Switch, FormControlLabel, InputAdornment } from '@material-ui/core';
import Images from '../../assets/Images';
import Constant from '../../library/Constant';
import api from '../../api';
......@@ -14,6 +14,7 @@ import CloudDownloadIcon from '@material-ui/icons/CloudDownload';
import moment from 'moment';
import CheckCircleOutlineIcon from '@material-ui/icons/CheckCircleOutline';
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
import SearchIcon from '@material-ui/icons/Search';
const IOSSwitch = withStyles((theme) => ({
......@@ -81,7 +82,10 @@ class DownloadReport extends Component {
this.state = {
load: false,
loading: false,
listDownload: []
listDownload: [],
oldListDownload: [],
search: "",
isSearch: false
}
}
......@@ -89,28 +93,49 @@ class DownloadReport extends Component {
componentDidMount() {
const interval = setInterval(() => {
this.getListDownload()
}, 500);
}, 1000);
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
// console.log(data);
let arr = [];
var groups = this.groupItems(data, "created_at"); // array will be grouped by 'date' property
for (var key in groups) {
if (this.state.search.length == 0) {
arr.push({
time: key,
items: groups[key],
});
} else {
let itmDtl = []
// console.log(groups);
groups[key].forEach((d) => {
let dtS = d.download_file_report_name;
let kS = this.state.search;
if (dtS.toLowerCase().includes(kS.toLowerCase())) {
itmDtl.push(d);
}
this.setState({ listDownload: arr })
})
let itm = {
time: key,
items: itmDtl
}
if (itmDtl.length > 0) {
arr.push(itm)
}
}
}
this.setState({ listDownload: arr, oldListDownload: arr })
} 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")) {
......@@ -160,6 +185,42 @@ class DownloadReport extends Component {
}
}
handleChange(e, type) {
this.setState({ search: e.target.value }, () => {
if (this.state.search.length == 0) {
this.setState({ listDownload: this.state.oldListDownload })
}
})
}
// handleSearch(key) {
// this.setState({ isSearch: true }, () => {
// let newListDownload = []
// console.log(this.state.oldListDownload);
// this.state.oldListDownload.forEach((i) => {
// let itmDtl = []
// i.items.forEach((d) => {
// let dtS = d.download_file_report_name;
// let kS = this.state.search;
// if (dtS.toLowerCase().includes(kS.toLowerCase())) {
// itmDtl.push(d);
// }
// })
// let itm = {
// time: i.time,
// items: itmDtl
// }
// if (itmDtl.length > 0) {
// newListDownload.push(itm)
// }
// })
// console.log(newListDownload);
// this.setState({ listDownload: newListDownload, isSearch: false })
// })
// }
render() {
let { listDownload, messageAlert, pageEmpty } = this.state
const loadingComponent = (
......@@ -186,11 +247,26 @@ class DownloadReport extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Download Report</Typography>
</div>
{listDownload.length > 0 ?
{listDownload.length > 0 || this.state.search.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 }}>
{listDownload.map((listItem) => {
<div style={{ display: 'flex', justifyContent: 'flex-end', marginBottom: 10 }}>
<TextField
variant="outlined"
id="search"
name="search"
value={this.state.search}
onChange={(e) => this.handleChange(e, '')}
size="small"
InputProps={{
style: { borderRadius: 7 },
endAdornment: <InputAdornment position="end"><SearchIcon /></InputAdornment>,
}}
/>
</div>
{!this.state.isSearch && (
listDownload.map((listItem) => {
return (
<div>
<div style={{ fontSize: 18, fontWeight: 700, color: '#273B80', marginLeft: 5, marginBottom: 10 }}>{listItem.time}</div>
......@@ -202,17 +278,17 @@ class DownloadReport extends Component {
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={{ 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>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '92%', background: '#D9D9D9', borderRadius: 10, marginBottom: 15, borderBottomLeftRadius: 0, borderTopLeftRadius: 0 }}>
<div style={{ marginRight: 10 }}>
<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>
<Typography style={{ marginLeft: 10, marginTop: 5, fontSize: 11, marginBottom: 10 }}>Last Download by: {item.created_by} - {item.created_at}</Typography>
</div>
<div style={{ display: 'flex', justifyContent: 'center', marginRight: 40 }}>
<div style={{ display: 'flex', justifyContent: 'center', marginRight: 20 }}>
{item.status === 1 ?
<button
type="button"
......@@ -275,8 +351,9 @@ class DownloadReport extends Component {
</div>
)
})}
<div style={{ fontSize: 12, fontWeight: 700, color: 'red', marginLeft: 5, marginBottom: 10 }}>Note : File download akan hilang dalam 3 hari setelah di generate.</div>
})
)}
<div style={{ fontSize: this.state.listDownload.length > 0 ? 12 : 18, fontWeight: 700, color: this.state.listDownload.length > 0 ? 'red' : 'black', marginLeft: 5, marginBottom: 10 }}>{this.state.listDownload.length > 0 ? 'Note : File download akan hilang dalam 3 hari setelah di generate.' : 'Data not found.'}</div>
</div>
</Paper>
</div>
......
......@@ -2444,7 +2444,7 @@ export default class TableSummaryTriputra extends Component {
<span>{"Debt to EBITDA"}</span>
</div>
<div className="column-4" style={{ borderRight: '1px #fff solid', justifyContent: 'center', display: 'flex', alignItems: 'center', backgroundColor: '#07a7d0', height: 40 }}>
<span>{"to Interest"}</span>
<span>{"EBITDA to Interest"}</span>
</div>
</div>
<div className="column-2 grid grid-4x" style={{ justifyContent: 'center', display: 'flex', alignItems: 'center', backgroundColor: '#07a7d0' }}>
......
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