Commit 0402a3cf authored by EKSAD's avatar EKSAD

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents 9dfaf10a 56a6e542
...@@ -168,6 +168,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -168,6 +168,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getDetailReportMB = (body) => api.post('/transaction/master_budget/get_report_hierarki', body) const getDetailReportMB = (body) => api.post('/transaction/master_budget/get_report_hierarki', body)
const createSubmitReport = (body) => api.post('transaction/master_budget/create_submission_report', body) const createSubmitReport = (body) => api.post('transaction/master_budget/create_submission_report', body)
const getSubmission = (body) => api.post('transaction/get_submission_id', body) const getSubmission = (body) => api.post('transaction/get_submission_id', body)
const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body)
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -291,7 +292,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -291,7 +292,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
updateDocument, updateDocument,
downloadDocument, downloadDocument,
createSubmitReport, createSubmitReport,
getSubmission getSubmission,
checkUploadMB
} }
} }
......
...@@ -8,6 +8,8 @@ import { values } from 'ramda'; ...@@ -8,6 +8,8 @@ import { values } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader" import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -40,9 +42,12 @@ export default class BalanceSheet extends Component { ...@@ -40,9 +42,12 @@ export default class BalanceSheet extends Component {
// ["Notes Receivable", "", ""], // ["Notes Receivable", "", ""],
// ["Accounts Receivable", "172,031", "97,112"], // ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"], // ["Trade Receivables - Third Party", "142,668", "77,480"],
] ],
visibleBalanceSheet: true,
disabledSave: true
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
...@@ -753,6 +758,134 @@ export default class BalanceSheet extends Component { ...@@ -753,6 +758,134 @@ export default class BalanceSheet extends Component {
this.props.onClickClose() this.props.onClickClose()
} }
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Balance Sheet.xlsx';
a.click();
}
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) {
console.log(err);
}
else {
let isi = resp.rows.slice(3)
console.log(isi);
let payload = []
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
total_actual_before: i[2] === undefined ? "" : String(i[2]).trim(),
january: i[3] === undefined ? "" : String(i[3]).trim(),
february: i[4] === undefined ? "" : String(i[4]).trim(),
march: i[5] === undefined ? "" : String(i[5]).trim(),
april: i[6] === undefined ? "" : String(i[6]).trim(),
may: i[7] === undefined ? "" : String(i[7]).trim(),
june: i[8] === undefined ? "" : String(i[8]).trim(),
july: i[9] === undefined ? "" : String(i[9]).trim(),
august: i[10] === undefined ? "" : String(i[10]).trim(),
september: i[11] === undefined ? "" : String(i[11]).trim(),
october: i[12] === undefined ? "" : String(i[12]).trim(),
november: i[13] === undefined ? "" : String(i[13]).trim(),
december: i[14] === undefined ? "" : String(i[14]).trim(),
total_current_year: i[15] === undefined ? "" : String(i[15]).trim(),
total_next_year: i[16] === undefined ? "" : String(i[16]).trim(),
total_more_year: i[16] === undefined ? "" : String(i[17]).trim()
})
}
})
let rows = isi.map((i, index) => {
return [
String(i[0]) === '-' ? 4 : 3,
0,
0,
"",
1,
i[0] === undefined ? "" : String(i[0]),
i[1] === undefined ? "" : String(i[1]),
i[2] === undefined ? "" : String(i[2]),
i[3] === undefined ? "" : String(i[3]),
i[4] === undefined ? "" : String(i[4]),
i[5] === undefined ? "" : String(i[5]),
i[6] === undefined ? "" : String(i[6]),
i[7] === undefined ? "" : String(i[7]),
i[8] === undefined ? "" : String(i[8]),
i[9] === undefined ? "" : String(i[9]),
i[10] === undefined ? "" : String(i[10]),
i[11] === undefined ? "" : String(i[11]),
i[12] === undefined ? "" : String(i[12]),
i[13] === undefined ? "" : String(i[13]),
i[14] === undefined ? "" : String(i[14]),
i[15] === undefined ? "" : String(i[15]),
i[16] === undefined ? "" : String(i[16])
]
})
let body = {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
balance_sheet: payload
}
// console.log(JSON.stringify(body))
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
}
});
}
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.item_report,
item.total_actual_before,
item.january,
item.february,
item.march,
item.april,
item.may,
item.june,
item.july,
item.august,
item.september,
item.october,
item.november,
item.december,
item.total_current_year,
item.total_next_year,
item.total_more_year,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false })
}
}
})
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
...@@ -861,13 +994,42 @@ export default class BalanceSheet extends Component { ...@@ -861,13 +994,42 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[4] == 0 ? {tableMeta.rowData[22] ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> tableMeta.rowData[22].length > 0 ?
tableMeta.rowData[22][0].field === 'item' ?
tableMeta.rowData[4] == 0 ?
<a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
</a>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<a data-tip={tableMeta.rowData[22][0].message} data-for="account">
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</a>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
: :
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
</div> :
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
} }
<ReactTooltip border={true} id="account" place="bottom" type="light" effect="solid" />
</div> </div>
) )
} }
...@@ -2248,6 +2410,12 @@ export default class BalanceSheet extends Component { ...@@ -2248,6 +2410,12 @@ export default class BalanceSheet extends Component {
) )
} }
} }
},
{
name: "",
options: {
display: false
}
} }
] ]
const loadingComponent = ( const loadingComponent = (
...@@ -2268,149 +2436,256 @@ export default class BalanceSheet extends Component { ...@@ -2268,149 +2436,256 @@ export default class BalanceSheet extends Component {
</div> </div>
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent}
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> {this.state.visibleBalanceSheet === true ?
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Balance Sheet</Typography> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
</div> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Balance Sheet</Typography>
<div style={{ padding: 20 }}> </div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ padding: 20 }}>
<div> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
</div> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
<div style={{ width: '50%' }}> </div>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '50%' }}>
<a data-tip={'Download Template'} data-for="template"> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => null} }}
> onClick={() => this.downloadTemplate()}
<img src={Images.template} /> >
</button> <img src={Images.template} />
</a> </button>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Upload'} data-for="upload"> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Upload'} data-for="upload">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => null} }}
> onClick={() => this.setState({ visibleUpload: true })}
<img src={Images.upload} /> >
</button> <img src={Images.upload} />
</a> </button>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Download'} data-for="download"> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Download'} data-for="download">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => null} }}
> onClick={() => null}
<img src={Images.download} /> >
</button> <img src={Images.download} />
</a> </button>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
</div> </div>
</div> </div>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider>} </MuiThemeProvider>}
</div>
</div> </div>
</div> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="col-1">
<div className="col-1"> <button
<button type="button"
type="button" onClick={() => this.backToMasterBudget('draft')}
onClick={() => this.backToMasterBudget('draft')} style={{
style={{ backgroundColor: 'transparent',
backgroundColor: 'transparent', cursor: 'pointer',
cursor: 'pointer', borderColor: 'transparent',
borderColor: 'transparent', outline: 'none'
outline: 'none' }}
}} >
> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<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>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography> </div>
</div> </button>
</button> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.props.onClickClose()
}}
>
<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' }}>Cancel</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.disabledSave}
onClick={() => this.backToMasterBudget('submitted')}
style={{
backgroundColor: 'transparent',
cursor: this.state.disabledSave === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
>
<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</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, disabledSave: false })
}, 100);
})
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
</div>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> </Paper>
<button :
className="button" <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
type="button" <div>
style={{ <div style={{ padding: 25 }}>
backgroundColor: 'transparent', <div>
cursor: 'pointer', <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
borderColor: 'transparent', <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
outline: 'none' <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
}}
onClick={() => {
this.props.onClickClose()
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> {this.state.dataLoaded && (
<button <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
type="button" {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
onClick={() => this.backToMasterBudget('submitted')} <MUIDataTable
style={{ data={dataTable2}
backgroundColor: 'transparent', columns={columns}
cursor: 'pointer', options={options}
borderColor: 'transparent', />
outline: 'none' </MuiThemeProvider>}
}} </div>
> )}
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 20 }}> </div>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
</div> <button
</button> type="button"
<button onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())}
className="button" style={{ marginRight: 20 }}
type="button" >
style={{ <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960'}}>
backgroundColor: 'transparent', <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
cursor: 'pointer', </div>
borderColor: 'transparent', </button>
outline: 'none' <button
}} type="button"
onClick={() => { disabled={this.state.buttonError == true ? true : false}
this.setState({loading: true}, () => { onClick={() => null}
setTimeout(() => { style={{ marginRight: 20 }}
this.setState({loading: false}) >
}, 100); <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</Typography>
}} </div>
> </button>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <button
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
}, 100);
})
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
</div>
</div>
</Paper>}
</div>
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
</div> </div>
</button> </div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })}
>
<img src={Images.close} />
</button>
</div>
</div> </div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MASTER BUDGET - BALANCE SHEET" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
</div> </div>
</Paper> </div>
</div> )}
</div> </div>
); );
} }
......
...@@ -777,6 +777,21 @@ export default class ProfitLoss extends Component { ...@@ -777,6 +777,21 @@ export default class ProfitLoss extends Component {
this.props.onClickClose() this.props.onClickClose()
} }
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Profit Loss.xlsx';
a.click();
}
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
...@@ -2357,7 +2372,7 @@ export default class ProfitLoss extends Component { ...@@ -2357,7 +2372,7 @@ export default class ProfitLoss extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() => this.downloadTemplate()}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -168,11 +168,11 @@ export default class CreateManagementDoc extends Component { ...@@ -168,11 +168,11 @@ export default class CreateManagementDoc extends Component {
validasi() { validasi() {
if (R.isNil(this.state.getPerusahaan)) { if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty.' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} else if (R.isNil(this.state.getDocument)) { } else if (R.isNil(this.state.getDocument)) {
this.setState({ errorDocument: true, msgErrorDocument: 'Category Cannot be Empty.' }) this.setState({ errorDocument: true, msgErrorDocument: 'Category Cannot be Empty' })
} else if (R.isNil(this.state.file)) { } else if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty.', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning' })
} else { } else {
const formData = new FormData(); const formData = new FormData();
formData.append("file", this.state.file); formData.append("file", this.state.file);
......
...@@ -162,9 +162,7 @@ export default class DocumentManagement extends Component { ...@@ -162,9 +162,7 @@ export default class DocumentManagement extends Component {
onClick={() => this.setState({ visibleCreate: true, refresh: '' })} onClick={() => this.setState({ visibleCreate: true, refresh: '' })}
style={{ marginRight: 25 }} style={{ marginRight: 25 }}
> >
<div style={{ width: 150, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <img src={Images.add} />
<span style={{ color: '#fff', fontSize: 11 }}>Add</span>
</div>
</button> </button>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
......
...@@ -15,7 +15,8 @@ export default class ManualBookTia extends Component { ...@@ -15,7 +15,8 @@ export default class ManualBookTia extends Component {
this.state = { this.state = {
dataTable: [], dataTable: [],
visibleCreate: false, visibleCreate: false,
refresh: '' refresh: '',
alert: false,
} }
} }
......
...@@ -23,7 +23,8 @@ export default class QReview extends Component { ...@@ -23,7 +23,8 @@ export default class QReview extends Component {
this.state = { this.state = {
dataTable: [], dataTable: [],
visibleCreate: false, visibleCreate: false,
refresh: '' refresh: '',
alert: false,
} }
} }
...@@ -47,9 +48,6 @@ export default class QReview extends Component { ...@@ -47,9 +48,6 @@ export default class QReview extends Component {
api.create().getAllDocument(payload).then((response) => { api.create().getAllDocument(payload).then((response) => {
console.log(response) console.log(response)
if (response.problem){
alert(response.problem)
}
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -94,7 +92,6 @@ export default class QReview extends Component { ...@@ -94,7 +92,6 @@ export default class QReview extends Component {
openPopUp = async (index, val, type) =>{ openPopUp = async (index, val, type) =>{
if (type === 'download') { if (type === 'download') {
console.log(this.state.docPath[val])
let res = await fetch( let res = await fetch(
"https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="+this.state.docPath[val]+"&&fileType="+index[5] "https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="+this.state.docPath[val]+"&&fileType="+index[5]
) )
...@@ -110,6 +107,10 @@ export default class QReview extends Component { ...@@ -110,6 +107,10 @@ export default class QReview extends Component {
} }
} }
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
let columns = [{ let columns = [{
name: "Action", name: "Action",
...@@ -117,7 +118,6 @@ export default class QReview extends Component { ...@@ -117,7 +118,6 @@ export default class QReview extends Component {
filter: false, filter: false,
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */} {/* {this.state.btnedit && <span> */}
......
...@@ -70,7 +70,7 @@ class Upload extends Component { ...@@ -70,7 +70,7 @@ class Upload extends Component {
// alert('File Tidak Boleh Lebih Dari 1MB') // alert('File Tidak Boleh Lebih Dari 1MB')
} }
} else { } else {
this.setState({ alertMessage: 'File extension not allowed.', alert: true }) this.setState({ alertMessage: 'File extension not allowed', alert: true })
// alert('File Tidak Mendukung') // alert('File Tidak Mendukung')
} }
} }
...@@ -81,7 +81,7 @@ class Upload extends Component { ...@@ -81,7 +81,7 @@ class Upload extends Component {
uploadProgress: false, uploadProgress: false,
percentage: '0' percentage: '0'
}) })
this.setState({ alertMessage: "File extension not allowed.", alert: true }) this.setState({ alertMessage: "File extension not allowed", alert: true })
// alert("Unsupported Media Type") // alert("Unsupported Media Type")
} }
} else { } else {
...@@ -105,7 +105,7 @@ class Upload extends Component { ...@@ -105,7 +105,7 @@ class Upload extends Component {
uploadProgress: false, uploadProgress: false,
percentage: '0' percentage: '0'
}) })
this.setState({ alertMessage: "File extension not allowed.", alert: true }) this.setState({ alertMessage: "File extension not allowed", alert: true })
// alert("Unsupported Media Type") // alert("Unsupported Media Type")
} }
} }
...@@ -154,7 +154,7 @@ class Upload extends Component { ...@@ -154,7 +154,7 @@ class Upload extends Component {
} }
} }
} else { } else {
this.setState({ alertMessage: 'File extension not allowed.', alert: true }) this.setState({ alertMessage: 'File extension not allowed', alert: true })
// alert('File Tidak Mendukung') // alert('File Tidak Mendukung')
} }
} }
......
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