Skip to content

Commit

Permalink
ADD new functionallity
Browse files Browse the repository at this point in the history
Hide show all items in the 3d view
  • Loading branch information
mboscolo committed Sep 5, 2024
1 parent a222daf commit da5aa56
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 18 deletions.
2 changes: 1 addition & 1 deletion plm_web_3d/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################
{
"name": "PLM Web 3d Support",
"version": "17.0.0.2",
"version": "17.0.0.3",
"author": "OmniaSolutions",
"website": "https://odooplm.omniasolutions.website",
"category": "Manufacturing/Product Lifecycle Management (PLM)",
Expand Down
27 changes: 10 additions & 17 deletions plm_web_3d/static/src/js/OdooCADApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,6 @@ function createMarker(){
return new_point
}

function search_document_tree(element) {
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById("input_search_document_tree");
filter = input.value.toUpperCase();
ul = document.getElementById("document_tree");
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("span")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}

function init() {
/*
Expand Down Expand Up @@ -284,7 +268,16 @@ function init() {
* Inizialize tree view search
*/
var input_document_tree = document.getElementById('input_search_document_tree');
input_document_tree.addEventListener("keyup", search_document_tree);
input_document_tree.addEventListener("keyup", OdooCad.search_document_tree);
/*
* function to hide show all components
*/
var bnt_hide_all_parts = document.getElementById('hide_all_parts');
bnt_hide_all_parts.addEventListener("click", OdooCad.hide_all);

var bnt_show_all_parts = document.getElementById('show_all_parts');
bnt_show_all_parts.addEventListener("click", OdooCad.show_all);

}


Expand Down
50 changes: 50 additions & 0 deletions plm_web_3d/static/src/js/lib/odoocad/odoocad.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class OdooCAD{
xmlhttp.open("GET", url, true);
xmlhttp.send();
}

get_li_structure(object, nested=false){
var self = this;
var found=false;
Expand Down Expand Up @@ -112,6 +113,55 @@ class OdooCAD{
return [out_lis + "</ul>", found];
}
//
hide_all(){
var i;
var tree_item_visibility = document.getElementsByClassName("tree_item_visibility");
for (i = 0; i < tree_item_visibility.length; i++) {
var icon = tree_item_visibility[i]
icon.classList.remove('fa-eye');
icon.classList.add('fa-eye-slash');

var groupObj = tree_ref_elements[icon.parentElement.attributes['webgl_ref_name'].value];
if (groupObj){
groupObj.visible=false;
}
}

/*
var icon = this;
if (icon.classList.contains('fa-eye')) {
*/
}
show_all(){
var i;
var tree_item_visibility = document.getElementsByClassName("tree_item_visibility");
for (i = 0; i < tree_item_visibility.length; i++) {
var icon = tree_item_visibility[i]
icon.classList.remove('fa-eye-slash');
icon.classList.add('fa-eye');
var groupObj = tree_ref_elements[icon.parentElement.attributes['webgl_ref_name'].value];
if (groupObj){
groupObj.visible=true;
}
}
}
search_document_tree(element) {
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById("input_search_document_tree");
filter = input.value.toUpperCase();
ul = document.getElementById("document_tree");
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("span")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
create_relation_structure(object){
var self = this;
var html_out = "<div class='tree_structure' style='overflow-y: scroll;min-height: 1px;max-height: 400px;'>";
Expand Down
2 changes: 2 additions & 0 deletions plm_web_3d/views/web_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
<hr class="datacard_line"/>
<div class="search_document_tree">
<input type="text" id="input_search_document_tree" placeholder="Search Here !!"/>
<button type="button" id="hide_all_parts" title="Hide" class="fa fa-moon-o"></button>
<button type="button" id="show_all_parts" title="Un-Hide" class="fa fa-lightbulb-o"></button>
</div>
<lu id="document_tree">
</lu>
Expand Down

0 comments on commit da5aa56

Please sign in to comment.