mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Refactor table buttons for printing (#4639)
- Make them to look like the other printing buttons
This commit is contained in:
		@@ -70,7 +70,7 @@
 | 
				
			|||||||
        <span class='fas fa-print'></span> <span class='caret'></span>
 | 
					        <span class='fas fa-print'></span> <span class='caret'></span>
 | 
				
			||||||
    </button>
 | 
					    </button>
 | 
				
			||||||
    <ul class='dropdown-menu'>
 | 
					    <ul class='dropdown-menu'>
 | 
				
			||||||
        <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-print'></span> {% trans "Print Label" %}</a>
 | 
					        <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a>
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -308,22 +308,28 @@ function setupFilterList(tableKey, table, target, options={}) {
 | 
				
			|||||||
    // Construct a set of buttons
 | 
					    // Construct a set of buttons
 | 
				
			||||||
    var buttons = '';
 | 
					    var buttons = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add 'print reports' button
 | 
					    let report_button = options.report && global_settings.REPORT_ENABLE;
 | 
				
			||||||
    if (options.report && global_settings.REPORT_ENABLE) {
 | 
					    let labels_button = options.labels && global_settings.LABEL_ENABLE;
 | 
				
			||||||
        buttons += makeFilterButton({
 | 
					 | 
				
			||||||
            id: `print-report-${tableKey}`,
 | 
					 | 
				
			||||||
            title: options.report.title || '{% trans "Print reports for selected items" %}',
 | 
					 | 
				
			||||||
            icon: 'fa-print',
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add 'print labels' button
 | 
					    if (report_button || labels_button) {
 | 
				
			||||||
    if (options.labels && global_settings.LABEL_ENABLE) {
 | 
					        let print_buttons = `
 | 
				
			||||||
        buttons += makeFilterButton({
 | 
					        <div class='btn-group' role='group'>
 | 
				
			||||||
            id: `print-labels-${tableKey}`,
 | 
					        <button id='printing-options' title='{% trans "Printing actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'>
 | 
				
			||||||
            title: options.labels.title || '{% trans "Print labels for selected items" %}',
 | 
					            <span class='fas fa-print'></span> <span class='caret'></span>
 | 
				
			||||||
            icon: 'fa-tag',
 | 
					        </button>
 | 
				
			||||||
        });
 | 
					        <ul class='dropdown-menu' role='menu'>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (labels_button) {
 | 
				
			||||||
 | 
					            print_buttons += `<li><a class='dropdown-item' href='#' id='print-labels-${tableKey}'><span class='fas fa-tag'></span> {% trans "Print Labels" %}</a></li>`;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (report_button) {
 | 
				
			||||||
 | 
					            print_buttons += `<li><a class='dropdown-item' href='#' id='print-report-${tableKey}'><span class='fas fa-file-pdf'></span> {% trans "Print Reports" %}</a></li>`;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        print_buttons += `</ul></div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        buttons += print_buttons;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add download button
 | 
					    // Add download button
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user