Commit 259b9b4a authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

tambahin icon download di managdoc

See merge request !289
parents bd7e13f7 58c7ee4a
......@@ -180,6 +180,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getAllDocument = (body) => api.post('document/get_all_document', body)
const uploadDocument = (body) => api.post('document/upload_document', body)
const updateDocument = (body) => api.post('document/update_document', body)
const downloadDocument = (body) => api.post('document/download_document', body)
// ------
// STEP 3
......@@ -288,6 +289,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getAllDocument,
uploadDocument,
updateDocument,
downloadDocument,
createSubmitReport,
getSubmission
}
......
......@@ -2,6 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import CreateManagementDoc from './CreateManagementDoc';
......@@ -39,8 +41,9 @@ export default class AuditTahunan extends Component {
api.create().getAllDocument(payload).then(response => {
console.log(response)
let dataTable = response.data.data.map(item => {
let dataTable = response.data.data.map((item, index) => {
return [
index,
item.document_name,
item.description,
item.company_name,
......@@ -56,8 +59,37 @@ export default class AuditTahunan extends Component {
}
render() {
let columns = [
"Nama File", "Keterangan", "Perusahaan", "Periode", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
let columns = [{
name: "Action",
options: {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return (
<div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */}
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{/* </span>} */}
</div >
);
}
}
}, "Nama File", "Keterangan", "Perusahaan", "Periode", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
]
return (
<div style={{ width: '100%' }}>
......
......@@ -2,6 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import CreateManagementDoc from './CreateManagementDoc';
......@@ -45,8 +47,9 @@ export default class BOD extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
let dataTable = response.data.data.map(item => {
let dataTable = response.data.data.map((item, index) => {
return [
index,
item.document_name,
item.description,
item.company_name,
......@@ -66,7 +69,37 @@ export default class BOD extends Component {
render() {
let columns = [
"Nama File", "Keterangan", "Perusahaan", "Periode", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
{
name: "Action",
options: {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return (
<div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */}
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{/* </span>} */}
</div >
);
}
}
}, "Nama File", "Keterangan", "Perusahaan", "Periode", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
]
return (
<div style={{ width: '100%' }}>
......
......@@ -143,6 +143,35 @@ export default class DocumentManagement extends Component {
this.setState({ alert: false })
}
getDownloadDocument(payload){
// console.log(payload)
api.create().downloadDocument(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
// this.getDataDocument(settingID)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleCreate: false })
}
else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
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' })
}
})
}
render() {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8' }}>
......@@ -202,6 +231,7 @@ export default class DocumentManagement extends Component {
<QReview
data={this.state.listData[this.state.tab]}
refresh={this.state.refresh}
getDownloadDocument={this.getDownloadDocument.bind(this)}
/>
:
this.state.id === 68543 ?
......@@ -226,8 +256,6 @@ export default class DocumentManagement extends Component {
{this.state.konfirmasi && (
<PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })}
// getList={() => this.getData.bind(this)}
// deleteAM={this.deleteAM.bind(this)}
uploadDocId={this.createUploadDocument.bind(this)}
/>
)}
......
......@@ -2,6 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
var ct = require("../../library/CustomTable");
......@@ -38,8 +40,9 @@ export default class ManualBookETMS extends Component {
api.create().getAllDocument(payload).then(response => {
console.log(response)
let dataTable = response.data.data.map(item => {
let dataTable = response.data.data.map((item, index) => {
return [
index,
item.document_name,
item.description,
item.company_name,
......@@ -54,8 +57,37 @@ export default class ManualBookETMS extends Component {
}
render() {
let columns = [
"Nama File", "Keterangan", "Perusahaan", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
let columns = [{
name: "Action",
options: {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return (
<div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */}
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{/* </span>} */}
</div >
);
}
}
}, "Nama File", "Keterangan", "Perusahaan", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
]
return (
<div style={{ width: '100%' }}>
......
......@@ -2,7 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -38,8 +39,9 @@ export default class ManualBookTia extends Component {
api.create().getAllDocument(payload).then(response => {
console.log(response)
let dataTable = response.data.data.map(item => {
let dataTable = response.data.data.map((item, index) => {
return [
index,
item.document_name,
item.description,
item.company_name,
......@@ -55,8 +57,37 @@ export default class ManualBookTia extends Component {
}
render() {
let columns = [
"Nama File", "Keterangan", "Perusahaan", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
let columns = [{
name: "Action",
options: {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return (
<div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */}
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{/* </span>} */}
</div >
);
}
}
}, "Nama File", "Keterangan", "Perusahaan", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
]
return (
<div style={{ width: '100%' }}>
......
......@@ -4,50 +4,15 @@ import { Typography } from '@material-ui/core';
import api from "../../api";
import Constant from '../../library/Constant';
export default class PopUpDeleteAM extends Component {
export default class PopUpKonfirmasi extends Component {
constructor(props) {
super(props)
this.state = {
id: '',
getApprovedBy: null,
getTypes: null,
}
}
componentDidMount() {
}
// getDetailAM() {
// api.create().getDetailAM(this.props.data[1]).then(response => {
// console.log(response.data)
// if (response.data) {
// if (response.ok) {
// if (response.data.status === "success") {
// let data = response.data.data
// this.setState({
// id: data.approval_matrix_id,
// getTypes: data.approval_type_name,
// getApprovedBy: data.fullname
// })
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
// if (response.data.message.includes("Someone Logged In")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
// }
// })
// }
onClickUpload() {
let payload = this.props.data
this.props.uploadDocId(payload)
......
......@@ -5,6 +5,8 @@ import { createMuiTheme, MuiThemeProvider, Snackbar } from '@material-ui/core';
import api from '../../api';
import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../library/Constant';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import CreateManagementDoc from './CreateManagementDoc';
......@@ -51,8 +53,9 @@ export default class QReview extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
let dataTable = response.data.data.map(item => {
let dataTable = response.data.data.map((item, index) => {
return [
index,
item.document_name,
item.description,
item.company_name,
......@@ -83,9 +86,61 @@ export default class QReview extends Component {
})
}
openPopUp(index, type){
if (type === 'download') {
const formData = new FormData();
formData.append("documentName", index[1]);
formData.append("fileType", index[5]);
this.setState({ formData }, ()=> {
this.props.getDownloadDocument(this.state.formData)
})
}
}
downloadDoc() {
let datax = this.state.index
console.log(datax)
// let payload = {
// "documentName": this.state.typeId.approval_type_id,
// "fileType": this.state.order
// }
// this.props.getDownloadDocument(payload)
}
render() {
let columns = [
"Nama File", "Keterangan", "Perusahaan", "Periode", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
let columns = [{
name: "Action",
options: {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return (
<div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */}
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 15
}}
// onClick={() => console.log(tableMeta)}
onClick={() => this.openPopUp(tableMeta.rowData, 'download')}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{/* </span>} */}
</div >
);
}
}
}, "Nama File", "Keterangan", "Perusahaan", "Periode", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
]
return (
<div style={{ width: '100%' }}>
......
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