Commit 84e6bd54 authored by syadziy's avatar syadziy

update doc management

parent f5b4e102
......@@ -30,16 +30,17 @@ export default class DocumentManagement extends Component {
btndelete: false,
load: false,
name: '',
userCompActive: []
userCompActive: [],
isHasAccessDocument: false,
}
}
getPermission() {
getPermission(subMenu) {
let payload = {
menu: "document management"
menu: subMenu
}
api.create().getPermission(payload).then(response => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
......@@ -60,28 +61,44 @@ export default class DocumentManagement extends Component {
}
selectTab = (event, newEvent) => {
this.setState({ tab: newEvent })
console.log(this.state.tab)
this.setState({ tab: newEvent }, () => {
console.log(this.state.tab)
this.getPermission(this.state.listData[this.state.tab].value.toLocaleLowerCase())
})
}
componentDidMount() {
this.getDataDocument()
this.getPermission()
// this.getPermission()
this.getDetailUser()
}
getDataDocument(id, name) {
api.create().getDocumentCategory().then(response => {
// console.log(response);
console.log(response);
if (response) {
if (response.data.status === "success") {
this.setState({
listData: response.data.data,
id: id === undefined ? response.data.data[0].setting_id : id,
name: name === undefined ? response.data.data[0].value : name,
loadTable: true,
refresh: id === undefined ? '' : 'create'
let dataList = []
response.data.data.map((item, index) => {
// if (item.value == "Manual Book TIA 4.0sss") {
dataList.push(item)
// }
})
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 {
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")) {
......@@ -255,7 +272,7 @@ export default class DocumentManagement extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Document Management</Typography>
</div>
<div style={{ padding: 20 }}>
{this.state.loading && loadingComponent}
{this.state.loading && loadingComponent && this.state.isHasAccessDocument}
<Paper style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{(this.state.btncreate) && <span>
......@@ -308,6 +325,11 @@ export default class DocumentManagement extends Component {
</div>
</Paper>
{!this.state.isHasAccessDocument && (
<Paper style={{ padding: 20 }}>
<label>You Don't Have Any Access in Document Management</label>
</Paper>
)}
</div>
{this.state.konfirmasi && (
<PopUpKonfirmasi
......
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