Commit dfe9e7ff authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

download template BU

See merge request !65
parents 5158b3cf 5a143dbe
...@@ -132,6 +132,21 @@ export default class UnitBisnis extends Component { ...@@ -132,6 +132,21 @@ export default class UnitBisnis extends Component {
}) })
} }
downloadFile = async () => {
let res = await fetch(
"https://trftia.eksad.com/tia-reporting-dev/public/attachment/download_file?fileName=BusinessUnitTemplate&&fileType=xlsx"
)
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 Business Unit.xlsx';
a.click();
}
}
render() { render() {
const columns = [{ const columns = [{
name: "Action", name: "Action",
...@@ -216,7 +231,16 @@ export default class UnitBisnis extends Component { ...@@ -216,7 +231,16 @@ export default class UnitBisnis extends Component {
{/* <input type="text" value={this.state.search} onChange={(e)=> this.setState({ search: e.target.value})} style={{ width: '100%'}} /> */} {/* <input type="text" value={this.state.search} onChange={(e)=> this.setState({ search: e.target.value})} style={{ width: '100%'}} /> */}
</div> </div>
<div style={{ width: '30%', justifyContent: 'space-around', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '30%', justifyContent: 'space-around', display: 'flex', flexFlow: 'wrap' }}>
<img src={Images.template} /> <button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.downloadFile()}
>
<img src={Images.template} />
</button>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
......
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