2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-03 05:48:47 +00:00

Refactor table buttons for printing (#4639)

- Make them to look like the other printing buttons
This commit is contained in:
Oliver 2023-04-20 22:12:33 +10:00 committed by GitHub
parent 68d1682000
commit c64ff9d569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 16 deletions

View File

@ -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 %}

View File

@ -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}`, if (report_button || labels_button) {
title: options.report.title || '{% trans "Print reports for selected items" %}', let print_buttons = `
icon: 'fa-print', <div class='btn-group' role='group'>
}); <button id='printing-options' title='{% trans "Printing actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'>
<span class='fas fa-print'></span> <span class='caret'></span>
</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>`;
} }
// Add 'print labels' button if (report_button) {
if (options.labels && global_settings.LABEL_ENABLE) { print_buttons += `<li><a class='dropdown-item' href='#' id='print-report-${tableKey}'><span class='fas fa-file-pdf'></span> {% trans "Print Reports" %}</a></li>`;
buttons += makeFilterButton({ }
id: `print-labels-${tableKey}`,
title: options.labels.title || '{% trans "Print labels for selected items" %}', print_buttons += `</ul></div>`;
icon: 'fa-tag',
}); buttons += print_buttons;
} }
// Add download button // Add download button