NEW : ShowAll/HideAll Options

This commit is contained in:
Adrien Raze 2021-08-23 11:58:15 +02:00
parent 093cec316d
commit 2343ff2ed4
3 changed files with 7 additions and 6 deletions

View File

@ -615,7 +615,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$(".collapse_bom").click(function() { $(".collapse_bom").click(function() {
var id_bom_line = $(this).attr('id').replace('collapse-', ''); var id_bom_line = $(this).attr('id').replace('collapse-', '');
console.log('tr [parentid="'+ id_bom_line +'"]')
if($(this).text().indexOf('+') > 0) { if($(this).text().indexOf('+') > 0) {
$('[parentid="'+ id_bom_line +'"]').show(); $('[parentid="'+ id_bom_line +'"]').show();
$(this).html('(-) '); $(this).html('(-) ');
@ -630,14 +629,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//TODO : SHOW ALL / COLLAPSE ALL //TODO : SHOW ALL / COLLAPSE ALL
$("#show_all").click(function() { $("#show_all").click(function() {
$("[class^=batch_warehouse]").show(); $("[class^=sub_bom_lines]").show();
$("[class^=collapse_batch]").html('(-) '); $("[class^=collapse_bom]").html('(-) ');
return false; return false;
}); });
$("#hide_all").click(function() { $("#hide_all").click(function() {
$("[class^=batch_warehouse]").hide(); $("[class^=sub_bom_lines]").hide();
$("[class^=collapse_batch]").html('(+) '); $("[class^=collapse_bom]").html('(+) ');
return false; return false;
}); });

View File

@ -43,6 +43,8 @@ print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
print "<thead>\n"; print "<thead>\n";
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
print '<a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
// Adds a line numbering column // Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {

View File

@ -193,7 +193,7 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db); $sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid); $sub_bom_line->fetch($obj->rowid);
print '<tr style="display:none" parentid="'.$line->id.'">'; print '<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.'">';
print '<td id="sub_bom_product_'.$sub_bom_line->id.'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$sub_bom_product->getNomUrl(1).'</td>'; print '<td id="sub_bom_product_'.$sub_bom_line->id.'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$sub_bom_product->getNomUrl(1).'</td>';
if ($sub_bom_line->fk_bom_child > 0) { if ($sub_bom_line->fk_bom_child > 0) {