Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
76bf230a
Commit
76bf230a
authored
Jul 15, 2022
by
muhammad ridwan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ENV-DEV-CR-CAFRM' into 'ENV-DEPLOYMENT'
Env dev cr cafrm See merge request
!1591
parents
29ffc9df
14e0c78a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
35 deletions
+39
-35
CarfmDocument.js
src/container/CRFM/CarfmDocument.js
+39
-35
No files found.
src/container/CRFM/CarfmDocument.js
View file @
76bf230a
...
...
@@ -20,15 +20,15 @@ export default class CarfmDocument extends Component {
alert
:
false
,
listData
:
[],
id
:
0
,
btncreate
:
false
,
btnview
:
false
,
load
:
false
,
name
:
''
,
userCompActive
:
[],
isHasAccessDocument
:
true
,
submenu_id
:
0
,
submenu_name
:
""
,
menu_title
:
""
menu_title
:
""
,
loading
:
true
,
finishLoad
:
false
,
}
}
...
...
@@ -37,8 +37,12 @@ export default class CarfmDocument extends Component {
// this.getPermission()
await
this
.
getMenuName
();
await
this
.
getPermission
(
this
.
state
.
submenu_name
)
await
this
.
getDataCarfm
();
await
this
.
getDetailUser
();
await
this
.
setState
({
finishLoad
:
true
})
}
...
...
@@ -77,25 +81,20 @@ export default class CarfmDocument extends Component {
if
(
response
.
data
.
status
===
'success'
){
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
,
isHasAccessDocument
:
true
,
listData
:
dataList
,
loadTable
:
true
,
refresh
:
create
==
undefined
?
''
:
create
},
()
=>
{
this
.
getPermission
(
this
.
state
.
submenu_name
)
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
...
...
@@ -117,13 +116,17 @@ export default class CarfmDocument extends Component {
}
await
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
console
.
log
(
`status get permission
${
response
.
data
.
status
}
`
);
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
btncreate
:
response
.
data
.
data
.
create
,
btnview
:
response
.
data
.
data
.
view
,
btndownload
:
response
.
data
.
data
.
download
,
load
:
true
load
:
true
,
})
this
.
setState
({
},
console
.
log
(
`btnview
${
this
.
state
.
btnview
}
, btncreate
${
this
.
state
.
btncreate
}
, btndownload
${
this
.
state
.
btnview
}
`
),
console
.
log
(
response
.
data
.
data
))
console
.
log
(
"btn create "
+
this
.
state
.
btncreate
);
}
else
{
this
.
setState
({
...
...
@@ -142,7 +145,7 @@ export default class CarfmDocument extends Component {
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
},
()
=>
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
,
loading
:
false
},
()
=>
{
this
.
getCompanyActive
()
console
.
log
(
this
.
state
.
userCompany
);
})
...
...
@@ -155,7 +158,7 @@ export default class CarfmDocument extends Component {
async
getCompanyActive
()
{
await
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
"getcompanyactive start"
);
console
.
log
(
response
);
console
.
log
(
response
.
data
.
data
);
console
.
log
(
"getcompanyactive stop"
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
...
...
@@ -163,8 +166,7 @@ export default class CarfmDocument extends Component {
let
compActive
=
[]
let
userCompActive
=
[]
this
.
state
.
userCompany
.
map
((
item
,
index
)
=>
{
let
indeks
=
data
.
findIndex
((
val
)
=>
val
.
company_id
==
item
)
if
(
indeks
!==
-
1
&&
String
(
data
[
indeks
].
status
).
toLocaleLowerCase
()
==
'active'
){
if
(
index
!==
-
1
&&
String
(
data
[
index
].
status
).
toLocaleLowerCase
()
==
'active'
){
userCompActive
.
push
(
item
)
}
})
...
...
@@ -179,7 +181,8 @@ export default class CarfmDocument extends Component {
this
.
setState
({
btnadd
:
false
})
}
this
.
setState
({
userCompActive
,
visibleTrue
:
true
})
// console.log(userCompActive)
console
.
log
(
"usercompactive"
)
console
.
log
(
userCompActive
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
visibleTrue
:
true
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
...
...
@@ -276,10 +279,11 @@ export default class CarfmDocument extends Component {
{
this
.
state
.
loading
&&
loadingComponent
}
<
Paper
style
=
{{
padding
:
20
}}
>
{
this
.
state
.
btnview
&&
this
.
state
.
finishLoad
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
{
console
.
log
(
"renderbtn"
+
this
.
state
.
btncreate
)}
{(
this
.
state
.
btncreate
)
&&
<
span
>
<
a
data
-
tip
=
{
'Add'
}
data
-
for
=
"add"
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
...
...
@@ -299,24 +303,24 @@ export default class CarfmDocument extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
state
.
visibleTrue
&&
(
<
TableDocument
data
=
{
this
.
state
.
listData
}
refresh
=
{
this
.
state
.
refresh
}
load
=
{
true
}
userCompActive
=
{
this
.
state
.
userCompActive
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
name
=
{
this
.
state
.
name
}
submenu_id
=
{
this
.
state
.
submenu_id
}
btndownload
=
{
this
.
state
.
btndownload
}
/>
)
}
{
this
.
state
.
visibleTrue
&&
(
<
TableDocument
data
=
{
this
.
state
.
listData
}
refresh
=
{
this
.
state
.
refresh
}
load
=
{
true
}
userCompActive
=
{
this
.
state
.
userCompActive
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
name
=
{
this
.
state
.
name
}
submenu_id
=
{
this
.
state
.
submenu_id
}
btndownload
=
{
this
.
state
.
btndownload
}
/
>
)}
<
/div
>
<
/Paper
>
)}
{
!
this
.
state
.
isHasAccessDocument
&&
(
{
!
this
.
state
.
btnview
&&
this
.
state
.
finishLoad
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
label
>
You
Don
't Have Any Access in Document Management</label>
</Paper>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment