Commit 1f34003e authored by Arfin Syadziy's avatar Arfin Syadziy

Merge branch 'env/ridwan' into 'ENV-DEV-CR-CAFRM'

Env/ridwan

See merge request !1574
parents f5b4e102 9bd4d0e2
// contents of .env // contents of .env
REACT_APP_URL_MAIN_BE=https://tia.eksad.com/tia-reporting-dev REACT_APP_URL_MAIN_BE=https://tia.eksad.com/tia-reporting
REACT_APP_URL_MAIN_FE=/tia-web-dev REACT_APP_URL_MAIN_FE=/tia-web-dev
"cpy_file_build_windows" : "robocopy E:\tia-web\src\tia-dev\src E:\tia-web\src /e", "cpy_file_build_windows" : "robocopy E:\tia-web\src\tia-dev\src E:\tia-web\src /e",
......
...@@ -470,6 +470,7 @@ const create = (type = "") => { ...@@ -470,6 +470,7 @@ const create = (type = "") => {
// MANAGEMENT DOCUMENT // MANAGEMENT DOCUMENT
// const getDocumentCategory = (body) => api.post('setting/get_all_setting_document_category', body) // const getDocumentCategory = (body) => api.post('setting/get_all_setting_document_category', body)
const getDocumentCategory = () => api.get('setting/get_all_setting_document_category') const getDocumentCategory = () => api.get('setting/get_all_setting_document_category')
const getCarfmDocumentBySubmenu = (body) => api.post('document/get_cafrm_document_by_submenu', body);
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)
...@@ -477,6 +478,8 @@ const create = (type = "") => { ...@@ -477,6 +478,8 @@ const create = (type = "") => {
const getPerusahaanUserActive = () => api.get('company/get_all_user_company_active') const getPerusahaanUserActive = () => api.get('company/get_all_user_company_active')
const getDetailDocument = (id) => api.get(`document/get_document_by_id/${id}`) const getDetailDocument = (id) => api.get(`document/get_document_by_id/${id}`)
const deleteDocument = (id) => api.post(`document/delete_document/${id}`) const deleteDocument = (id) => api.post(`document/delete_document/${id}`)
const uploadCarfmDocument = (body) => api.post('document/upload_cafrm_document', body)
// Monitoring // Monitoring
const getMonitoringMB = (body) => api.get(`transaction/monitoring/submission/${body.year}`) const getMonitoringMB = (body) => api.get(`transaction/monitoring/submission/${body.year}`)
...@@ -591,9 +594,11 @@ const create = (type = "") => { ...@@ -591,9 +594,11 @@ const create = (type = "") => {
deleteParameter, deleteParameter,
deletePerusahaan, deletePerusahaan,
deleteReportItems, deleteReportItems,
getCarfmDocumentBySubmenu,
getDocumentCategory, getDocumentCategory,
getAllDocument, getAllDocument,
uploadDocument, uploadDocument,
uploadCarfmDocument,
updateDocument, updateDocument,
downloadDocument, downloadDocument,
getPerusahaanUserActive, getPerusahaanUserActive,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import React, {Component} from 'react';
import api from "../../api";
import Constant from "../../library/Constant";
import Images from "../../assets/Images";
import ReactTooltip from "react-tooltip";
import PropagateLoader from "react-spinners/PropagateLoader";
import {createMuiTheme, MuiThemeProvider, Snackbar} from "@material-ui/core";
import MUIDataTable from "mui-datatables";
import {withStyles} from "@material-ui/core/styles";
import MuiAlert from "@material-ui/lab/Alert";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptionsManagementDocument();
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class TableDocument extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [],
visibleCreate: false,
refresh: '',
alert: false,
}
}
componentDidMount() {
this.getData()
}
componentWillReceiveProps(props) {
// console.log(props);
const { refresh} = this.props;
if (props.refresh !== refresh) {
this.getData()
}
}
getData() {
let payload = {
"submenu_id": this.props.submenu_id
}
this.setState({ loading: true })
api.create().getCarfmDocumentBySubmenu(payload).then(response => {
console.log("table document carfm");
console.log(response)
console.log("table document carfm stop")
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
let dataTable = []
response.data.data.map((item, index) => {
let indexId = this.props.userCompActive.findIndex((val) => val == item.company_id)
if (indexId !== -1) {
dataTable.push( [
index,
item.document_name,
item.description,
item.company_name,
item.document_month,
item.document_periode,
item.document_type,
String(Number(item.document_size) / 1000 + ' KB'),
item.created_by,
item.created_at,
item.values
])
}
})
// console.log(dataTable)
this.setState({ dataTable, loading: false })
let docPath = response.data.data.map((item) => {
return [
item.document_filepath
]
})
this.setState({ docPath, loading: false })
let docId = response.data.data.map((item) => {
return [
item.document_id
]
})
this.setState({ docId, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
console.log("error di table document getcarfm 1");
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
console.log("error di table document getcarfm 2");
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
openPopUp = async (index, val, type) =>{
console.log(index)
if (type === 'download') {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/document/download_cafrm_document?documentName=`+this.state.docPath[val]+"&&fileType="+index[6]
)
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 = (String(index[3]).includes(":") ? String(index[3]).replace(":", " (") + ` )` : String(index[3])) +" - "+index[4]+" - "+index[5]+" - "+index[10]+"."+index[6];
a.click();
}
}
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let columns = [{
name: "Action",
options: {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
{this.props.btndownload && <a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginRight: 15
}}
onClick={() => this.openPopUp(tableMeta.rowData, val, 'download')}
>
<img src={Images.download} />
</button>
</a>}
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "File Name",
options: {
display: false
}
},
"Description", "Company Name", "Period Month", "Period Year",
"Type", "File Size", "Created By", "Created Date",
{
name: "Category",
options: {
display: false
}
},
]
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ width: '100%' }}>
{this.props.load && (
<div style={{ padding: 25 }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
// theme={getMuiTheme()}
data={this.state.dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
)}
</div>
)
}
}
...@@ -30,16 +30,17 @@ export default class DocumentManagement extends Component { ...@@ -30,16 +30,17 @@ export default class DocumentManagement extends Component {
btndelete: false, btndelete: false,
load: false, load: false,
name: '', name: '',
userCompActive: [] userCompActive: [],
isHasAccessDocument: false,
} }
} }
getPermission() { getPermission(subMenu) {
let payload = { let payload = {
menu: "document management" menu: subMenu
} }
api.create().getPermission(payload).then(response => { api.create().getPermission(payload).then(response => {
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -60,28 +61,44 @@ export default class DocumentManagement extends Component { ...@@ -60,28 +61,44 @@ export default class DocumentManagement extends Component {
} }
selectTab = (event, newEvent) => { selectTab = (event, newEvent) => {
this.setState({ tab: newEvent }) this.setState({ tab: newEvent }, () => {
console.log(this.state.tab) console.log(this.state.tab)
this.getPermission(this.state.listData[this.state.tab].value.toLocaleLowerCase())
})
} }
componentDidMount() { componentDidMount() {
this.getDataDocument() this.getDataDocument()
this.getPermission() // this.getPermission()
this.getDetailUser() this.getDetailUser()
} }
getDataDocument(id, name) { getDataDocument(id, name) {
api.create().getDocumentCategory().then(response => { api.create().getDocumentCategory().then(response => {
// console.log(response); console.log(response);
if (response) { if (response) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ let dataList = []
listData: response.data.data, response.data.data.map((item, index) => {
id: id === undefined ? response.data.data[0].setting_id : id, // if (item.value == "Manual Book TIA 4.0sss") {
name: name === undefined ? response.data.data[0].value : name, dataList.push(item)
loadTable: true, // }
refresh: id === undefined ? '' : 'create'
}) })
if (dataList.length == 0) {
this.setState({ isHasAccessDocument: dataList.length == 0 ? false : true })
} else {
this.setState({
isHasAccessDocument: dataList.length == 0 ? false : true,
listData: dataList,
id: id === undefined ? dataList[0].setting_id : id,
name: name === undefined ? dataList[0].value : name,
loadTable: true,
refresh: id === undefined ? '' : 'create'
}, () => {
this.getPermission(dataList[0].value)
})
}
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
...@@ -255,7 +272,7 @@ export default class DocumentManagement extends Component { ...@@ -255,7 +272,7 @@ export default class DocumentManagement extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Document Management</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Document Management</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent && this.state.isHasAccessDocument}
<Paper style={{ padding: 20 }}> <Paper style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{(this.state.btncreate) && <span> {(this.state.btncreate) && <span>
...@@ -308,6 +325,11 @@ export default class DocumentManagement extends Component { ...@@ -308,6 +325,11 @@ export default class DocumentManagement extends Component {
</div> </div>
</Paper> </Paper>
{!this.state.isHasAccessDocument && (
<Paper style={{ padding: 20 }}>
<label>You Don't Have Any Access in Document Management</label>
</Paper>
)}
</div> </div>
{this.state.konfirmasi && ( {this.state.konfirmasi && (
<PopUpKonfirmasi <PopUpKonfirmasi
......
...@@ -21,6 +21,9 @@ import SubHolding from '../container/Laporan/SubHolding'; ...@@ -21,6 +21,9 @@ import SubHolding from '../container/Laporan/SubHolding';
import SummaryTriputra from '../container/SummaryTriputra/SummaryOfTriputra'; import SummaryTriputra from '../container/SummaryTriputra/SummaryOfTriputra';
import MasterDataCAT from '../container/MasterData/MasterDataCAT/MasterDataCAT' import MasterDataCAT from '../container/MasterData/MasterDataCAT/MasterDataCAT'
import ProgressReport from '../container/Progress/ProgressReport' import ProgressReport from '../container/Progress/ProgressReport'
import InternalAudit from "../container/CRFM/InternalAudit";
import AntiFraud from "../container/CRFM/AntiFraud";
import RiskManagement from "../container/CRFM/RiskManagement";
const routes = [ const routes = [
{ {
...@@ -111,6 +114,18 @@ const routes = [ ...@@ -111,6 +114,18 @@ const routes = [
path: "/home/progress-reports", path: "/home/progress-reports",
main: ProgressReport main: ProgressReport
}, },
{
path: "/home/internal-audit",
main: InternalAudit
},
{
path: "/home/anti-fraud",
main: AntiFraud
},
{
path: "/home/risk-management",
main: RiskManagement
},
{ {
path: "*", path: "*",
main: screen404 main: screen404
......
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