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
6030f5e0
Commit
6030f5e0
authored
Sep 07, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finally
parent
2a53aaeb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
12 deletions
+58
-12
AddRole.js
src/container/Otorisasi/UserRole/AddRole.js
+58
-12
No files found.
src/container/Otorisasi/UserRole/AddRole.js
View file @
6030f5e0
...
...
@@ -340,7 +340,7 @@ export default class AddRole extends Component {
if
(
indexButtonID
===
-
1
)
{
button_id
.
push
(
index
)
console
.
log
(
item
)
//
console.log(item)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
...
...
@@ -352,24 +352,70 @@ export default class AddRole extends Component {
})
}
else
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
[]
console
.
log
(
subIndexButtonID
,
subButton_id
)
if
(
subIndexButtonID
===
-
1
)
{
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
===
-
1
)
{
subButton_id
.
push
(
index
)
privileges
[
subIndexID
].
button_id
=
subButton_id
}
else
{
subButton_id
=
privileges
[
subIndexID
].
button_id
console
.
log
(
subButton_id
)
subButton_id
.
splice
(
subIndexButtonID
,
1
)
privileges
[
subIndexID
].
button_id
=
subButton_id
.
sort
((
a
,
b
)
=>
a
-
b
)
}
// privileges[subIndexID].button_id = subButton_id
// console.log(subButton_id)
}
// let subIndexButtonID = privileges[subIndexID].button_id.findIndex((val) => val === indexs)
// let subButton_id = privileges[indexID].button_id
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
if
(
refIndexButtonID
===
-
1
)
{
refButton_id
.
push
(
index
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
else
{
button_id
.
splice
(
indexButtonID
,
1
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
!==
-
1
)
{
// console.log('masuk pa eko', subIndexID)
subButton_id
.
splice
(
subIndexButtonID
,
1
)
privileges
[
subIndexID
].
button_id
=
subButton_id
if
(
privileges
[
subIndexID
].
button_id
.
length
<
1
)
{
privileges
.
splice
(
subIndexID
,
1
)
}
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
let
indexIDapp
=
this
.
state
.
application
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDset
=
this
.
state
.
setting
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDs
=
indexIDapp
==
-
1
?
indexIDset
:
indexIDapp
let
array
=
indexIDapp
==
-
1
?
this
.
state
.
setting
:
this
.
state
.
application
let
splicer
=
0
array
[
indexIDs
].
sub_menu
.
map
((
refItem
,
refIndex
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
refItem
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
if
(
subIndexButtonID
!==
-
1
)
{
splicer
+=
1
}
}
})
if
(
refIndexButtonID
!==
-
1
&&
splicer
<
1
)
{
refButton_id
.
splice
(
refIndexButtonID
,
1
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
privileges
[
indexID
].
button_id
=
button_id
.
sort
((
a
,
b
)
=>
a
-
b
)
if
(
button_id
.
length
===
0
)
{
...
...
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