Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
check
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_web
check
Commits
84c4489d
Commit
84c4489d
authored
Nov 15, 2022
by
NGUYEN HOANG SON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix operation category multi level
parent
d434b3ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
abweb/js/operationList/operationList.js
+22
-21
No files found.
abweb/js/operationList/operationList.js
View file @
84c4489d
...
...
@@ -299,12 +299,12 @@ OL.createCategoryList = function () {
//Create a side menu category structure
var
categoryListElement
=
$
(
'#categoryListMenu'
);
categoryListElement
.
empty
();
//sort group master list by level low to hight
OL
.
operationGroupMaster
.
sort
(
function
(
a
,
b
)
{
if
(
a
.
operationGroupMasterLevel
<
b
.
operationGroupMasterLevel
)
return
-
1
;
if
(
a
.
operationGroupMasterLevel
>
b
.
operationGroupMasterLevel
)
return
1
;
return
1
;
});
let
allChecked
=
''
;
if
(
typeof
OL
.
operationGroupMasterId
===
'undefined'
||
OL
.
operationGroupMasterId
==
0
)
{
allChecked
=
' checked'
;
...
...
@@ -316,7 +316,6 @@ OL.createCategoryList = function () {
//create category(operationGroupMaster) structure
for
(
let
i
=
0
;
i
<
OL
.
operationGroupMaster
.
length
;
i
++
)
{
const
item
=
OL
.
operationGroupMaster
[
i
];
console
.
log
(
item
);
let
inputLabel
=
$
(
'<label>'
);
let
inputRadio
=
$
(
'<input type="radio" name="category">'
);
inputRadio
.
val
(
item
.
operationGroupMasterId
);
...
...
@@ -326,11 +325,20 @@ OL.createCategoryList = function () {
let
groupSpan
=
$
(
'<span>'
+
item
.
operationGroupMasterName
+
'</span>'
);
inputLabel
.
append
(
inputRadio
);
inputLabel
.
append
(
groupSpan
);
if
(
item
.
operationGroupMasterLevel
==
0
)
{
const
isParent
=
OL
.
operationGroupMaster
.
find
(
function
(
child
)
{
return
item
.
operationGroupMasterId
==
child
.
parentOperationGroupMasterId
;
});
let
parentElement
=
categoryListElement
;
if
(
item
.
parentOperationGroupMasterId
!=
0
)
{
parentElement
=
$
(
'#collapse'
+
item
.
parentOperationGroupMasterId
+
' > ul'
);
}
if
(
isParent
)
{
//accordion
const
accordionId
=
'accordion'
+
item
.
operationGroupMasterId
;
const
headingId
=
'heading'
+
item
.
operationGroupMasterId
;
const
collapseId
=
'collapse'
+
item
.
operationGroupMasterId
;
let
categoryParentElm
=
$
(
'<li class="accordion" id="'
+
accordionId
+
'" />'
);
let
accordionElm
=
$
(
'<li class="accordion" id="'
+
accordionId
+
'" />'
);
//heading
let
headingDiv
=
$
(
'<div id="'
+
headingId
+
'" />'
);
let
linkA
=
$
(
'<a class="list-menu-link" />'
);
let
collapseButton
=
$
(
'<button type="button" class="collapsed" data-toggle="collapse" aria-expanded="true" />'
);
...
...
@@ -340,26 +348,19 @@ OL.createCategoryList = function () {
linkA
.
append
(
collapseButton
);
linkA
.
append
(
inputLabel
);
headingDiv
.
append
(
linkA
);
categoryParentElm
.
append
(
headingDiv
);
categoryListElement
.
append
(
categoryParentElm
);
//collapse
let
collapseElm
=
$
(
'<div id="'
+
collapseId
+
'" class="collapse">'
);
collapseElm
.
attr
(
'data-parent'
,
'#'
+
accordionId
);
collapseElm
.
attr
(
'aria-labelledby'
,
headingId
);
let
ul
=
$
(
'<ul>'
);
collapseElm
.
append
(
ul
);
accordionElm
.
append
(
headingDiv
);
accordionElm
.
append
(
collapseElm
);
parentElement
.
append
(
accordionElm
);
}
else
{
let
li
=
$
(
'<li>'
);
li
.
append
(
inputLabel
);
let
parentElm
=
$
(
'#collapse'
+
item
.
parentOperationGroupMasterId
+
' > ul'
);
if
(
typeof
parentElm
===
'undefined'
||
!
parentElm
||
parentElm
.
length
<
1
)
{
const
accordionParentId
=
'accordion'
+
item
.
parentOperationGroupMasterId
;
const
headingParentId
=
'heading'
+
item
.
parentOperationGroupMasterId
;
const
collapseParentId
=
'collapse'
+
item
.
parentOperationGroupMasterId
;
parentElm
=
$
(
'<div id="'
+
collapseParentId
+
'" class="collapse">'
);
parentElm
.
attr
(
'data-parent'
,
'#'
+
accordionParentId
);
parentElm
.
attr
(
'aria-labelledby'
,
headingParentId
);
let
ul
=
$
(
'<ul>'
);
ul
.
append
(
li
);
parentElm
.
append
(
ul
);
$
(
'#'
+
accordionParentId
).
append
(
parentElm
);
}
else
{
parentElm
.
append
(
li
);
}
parentElement
.
append
(
li
);
}
}
};
...
...
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