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/') => ...@@ -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 getAllDocument = (body) => api.post('document/get_all_document', body)
const uploadDocument = (body) => api.post('document/upload_document', body) const uploadDocument = (body) => api.post('document/upload_document', body)
const updateDocument = (body) => api.post('document/update_document', body) const updateDocument = (body) => api.post('document/update_document', body)
const downloadDocument = (body) => api.post('document/download_document', body)
// ------ // ------
// STEP 3 // STEP 3
...@@ -288,6 +289,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -288,6 +289,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getAllDocument, getAllDocument,
uploadDocument, uploadDocument,
updateDocument, updateDocument,
downloadDocument,
createSubmitReport, createSubmitReport,
getSubmission getSubmission
} }
......
...@@ -2,6 +2,8 @@ import React, { Component } from 'react' ...@@ -2,6 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables' import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api'; import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import CreateManagementDoc from './CreateManagementDoc'; import CreateManagementDoc from './CreateManagementDoc';
...@@ -39,8 +41,9 @@ export default class AuditTahunan extends Component { ...@@ -39,8 +41,9 @@ export default class AuditTahunan extends Component {
api.create().getAllDocument(payload).then(response => { api.create().getAllDocument(payload).then(response => {
console.log(response) console.log(response)
let dataTable = response.data.data.map(item => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index,
item.document_name, item.document_name,
item.description, item.description,
item.company_name, item.company_name,
...@@ -56,8 +59,37 @@ export default class AuditTahunan extends Component { ...@@ -56,8 +59,37 @@ export default class AuditTahunan extends Component {
} }
render() { render() {
let columns = [ 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 ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
......
...@@ -2,6 +2,8 @@ import React, { Component } from 'react' ...@@ -2,6 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables' import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api'; import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import CreateManagementDoc from './CreateManagementDoc'; import CreateManagementDoc from './CreateManagementDoc';
...@@ -45,8 +47,9 @@ export default class BOD extends Component { ...@@ -45,8 +47,9 @@ export default class BOD extends Component {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let dataTable = response.data.data.map(item => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index,
item.document_name, item.document_name,
item.description, item.description,
item.company_name, item.company_name,
...@@ -66,7 +69,37 @@ export default class BOD extends Component { ...@@ -66,7 +69,37 @@ export default class BOD extends Component {
render() { render() {
let columns = [ 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 ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
......
...@@ -143,6 +143,35 @@ export default class DocumentManagement extends Component { ...@@ -143,6 +143,35 @@ export default class DocumentManagement extends Component {
this.setState({ alert: false }) 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() { render() {
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8' }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8' }}>
...@@ -202,6 +231,7 @@ export default class DocumentManagement extends Component { ...@@ -202,6 +231,7 @@ export default class DocumentManagement extends Component {
<QReview <QReview
data={this.state.listData[this.state.tab]} data={this.state.listData[this.state.tab]}
refresh={this.state.refresh} refresh={this.state.refresh}
getDownloadDocument={this.getDownloadDocument.bind(this)}
/> />
: :
this.state.id === 68543 ? this.state.id === 68543 ?
...@@ -226,8 +256,6 @@ export default class DocumentManagement extends Component { ...@@ -226,8 +256,6 @@ export default class DocumentManagement extends Component {
{this.state.konfirmasi && ( {this.state.konfirmasi && (
<PopUpKonfirmasi <PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })} onClickClosePopUp={() => this.setState({ konfirmasi: false })}
// getList={() => this.getData.bind(this)}
// deleteAM={this.deleteAM.bind(this)}
uploadDocId={this.createUploadDocument.bind(this)} uploadDocId={this.createUploadDocument.bind(this)}
/> />
)} )}
......
...@@ -2,6 +2,8 @@ import React, { Component } from 'react' ...@@ -2,6 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables' import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api'; import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
...@@ -38,8 +40,9 @@ export default class ManualBookETMS extends Component { ...@@ -38,8 +40,9 @@ export default class ManualBookETMS extends Component {
api.create().getAllDocument(payload).then(response => { api.create().getAllDocument(payload).then(response => {
console.log(response) console.log(response)
let dataTable = response.data.data.map(item => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index,
item.document_name, item.document_name,
item.description, item.description,
item.company_name, item.company_name,
...@@ -54,8 +57,37 @@ export default class ManualBookETMS extends Component { ...@@ -54,8 +57,37 @@ export default class ManualBookETMS extends Component {
} }
render() { render() {
let columns = [ let columns = [{
"Nama File", "Keterangan", "Perusahaan", "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", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
] ]
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
......
...@@ -2,7 +2,8 @@ import React, { Component } from 'react' ...@@ -2,7 +2,8 @@ import React, { Component } from 'react'
import MUIDataTable from 'mui-datatables' import MUIDataTable from 'mui-datatables'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import api from '../../api'; import api from '../../api';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -38,8 +39,9 @@ export default class ManualBookTia extends Component { ...@@ -38,8 +39,9 @@ export default class ManualBookTia extends Component {
api.create().getAllDocument(payload).then(response => { api.create().getAllDocument(payload).then(response => {
console.log(response) console.log(response)
let dataTable = response.data.data.map(item => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index,
item.document_name, item.document_name,
item.description, item.description,
item.company_name, item.company_name,
...@@ -55,8 +57,37 @@ export default class ManualBookTia extends Component { ...@@ -55,8 +57,37 @@ export default class ManualBookTia extends Component {
} }
render() { render() {
let columns = [ let columns = [{
"Nama File", "Keterangan", "Perusahaan", "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", "Tipe", "Ukuran", "Ditambahkan Oleh", "Ditambahkan Tanggal"
] ]
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
......
...@@ -4,50 +4,15 @@ import { Typography } from '@material-ui/core'; ...@@ -4,50 +4,15 @@ import { Typography } from '@material-ui/core';
import api from "../../api"; import api from "../../api";
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
export default class PopUpDeleteAM extends Component { export default class PopUpKonfirmasi extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
id: '',
getApprovedBy: null,
getTypes: null,
} }
} }
componentDidMount() { 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() { onClickUpload() {
let payload = this.props.data let payload = this.props.data
this.props.uploadDocId(payload) this.props.uploadDocId(payload)
......
...@@ -5,6 +5,8 @@ import { createMuiTheme, MuiThemeProvider, Snackbar } from '@material-ui/core'; ...@@ -5,6 +5,8 @@ import { createMuiTheme, MuiThemeProvider, Snackbar } from '@material-ui/core';
import api from '../../api'; import api from '../../api';
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import CreateManagementDoc from './CreateManagementDoc'; import CreateManagementDoc from './CreateManagementDoc';
...@@ -31,12 +33,12 @@ export default class QReview extends Component { ...@@ -31,12 +33,12 @@ export default class QReview extends Component {
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
// console.log(props); // console.log(props);
const { refresh, id } = this.props; const { refresh, id } = this.props;
if (props.refresh !== refresh) { if (props.refresh !== refresh) {
this.getData() this.getData()
}
} }
}
getData() { getData() {
let payload = { let payload = {
...@@ -51,8 +53,9 @@ export default class QReview extends Component { ...@@ -51,8 +53,9 @@ export default class QReview extends Component {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let dataTable = response.data.data.map(item => { let dataTable = response.data.data.map((item, index) => {
return [ return [
index,
item.document_name, item.document_name,
item.description, item.description,
item.company_name, item.company_name,
...@@ -83,9 +86,61 @@ export default class QReview extends Component { ...@@ -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() { render() {
let columns = [ 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, '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 ( return (
<div style={{ width: '100%' }}> <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