Hide barcode actions if barcode support is disabled

This commit is contained in:
Oliver Walters 2021-01-28 20:45:42 +11:00
parent 51a33e5dca
commit 7e8def15ed
3 changed files with 56 additions and 42 deletions

View File

@ -44,6 +44,8 @@
<span id='part-star-icon' class='fas fa-star {% if starred %}icon-yellow{% endif %}'/> <span id='part-star-icon' class='fas fa-star {% if starred %}icon-yellow{% endif %}'/>
</button> </button>
{% settings_value 'BARCODE_ENABLE' as barcodes %}
{% if barcodes %}
<!-- Barcode actions menu --> <!-- Barcode actions menu -->
<div class='btn-group'> <div class='btn-group'>
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button> <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
@ -52,6 +54,7 @@
<li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> <li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
</ul> </ul>
</div> </div>
{% endif %}
{% if part.active %} {% if part.active %}
<button type='button' class='btn btn-default' id='price-button' title='{% trans "Show pricing information" %}'> <button type='button' class='btn btn-default' id='price-button' title='{% trans "Show pricing information" %}'>
<span id='part-price-icon' class='fas fa-dollar-sign'/> <span id='part-price-icon' class='fas fa-dollar-sign'/>

View File

@ -120,6 +120,8 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
</div> </div>
<div class='btn-group action-buttons' role='group'> <div class='btn-group action-buttons' role='group'>
{% settings_value 'BARCODE_ENABLE' as barcodes %}
{% if barcodes %}
<!-- Barcode actions menu --> <!-- Barcode actions menu -->
<div class='btn-group'> <div class='btn-group'>
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button> <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
@ -127,24 +129,26 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<li><a href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> <li><a href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li>
{% if roles.stock.change %} {% if roles.stock.change %}
{% if item.uid %} {% if item.uid %}
<li><a href='#' id='unlink-barcode'><span class='fas fa-unlink'></span> {% trans "Unlink Barcode" %}</a></li> <li><a href='#' id='barcode-unlink'><span class='fas fa-unlink'></span> {% trans "Unlink Barcode" %}</a></li>
{% else %} {% else %}
<li><a href='#' id='link-barcode'><span class='fas fa-link'></span> {% trans "Link Barcode" %}</a></li> <li><a href='#' id='barcode-link'><span class='fas fa-link'></span> {% trans "Link Barcode" %}</a></li>
{% endif %} {% endif %}
{% endif %} <li><a href='#' id='barcode-scan-into-location'><span class='fas fa-sitemap'></span> {% trans "Scan to Location" %}</a></li>
</ul> {% endif %}
</div> </ul>
<!-- Document / label menu --> </div>
{% if item.has_labels or item.has_test_reports %} {% endif %}
<div class='btn-group'> <!-- Document / label menu -->
<button id='document-options' title='{% trans "Printing actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-print'></span> <span class='caret'></span></button> {% if item.has_labels or item.has_test_reports %}
<ul class='dropdown-menu' role='menu'> <div class='btn-group'>
{% if item.has_labels %} <button id='document-options' title='{% trans "Printing actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-print'></span> <span class='caret'></span></button>
<li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> <ul class='dropdown-menu' role='menu'>
{% endif %} {% if item.has_labels %}
{% if item.has_test_reports %} <li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
<li><a href='#' id='stock-test-report'><span class='fas fa-file-pdf'></span> {% trans "Test Report" %}</a></li> {% endif %}
{% endif %} {% if item.has_test_reports %}
<li><a href='#' id='stock-test-report'><span class='fas fa-file-pdf'></span> {% trans "Test Report" %}</a></li>
{% endif %}
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
@ -447,14 +451,18 @@ $("#show-qr-code").click(function() {
}); });
}); });
$("#link-barcode").click(function() { $("#barcode-link").click(function() {
linkBarcodeDialog({{ item.id }}); linkBarcodeDialog({{ item.id }});
}); });
$("#unlink-barcode").click(function() { $("#barcode-unlink").click(function() {
unlinkBarcode({{ item.id }}); unlinkBarcode({{ item.id }});
}); });
$("#barcode-scan-into-location").click(function() {
scanItemIntoLocation({{ item.id }});
});
{% if item.in_stock %} {% if item.in_stock %}
$("#stock-assign-to-customer").click(function() { $("#stock-assign-to-customer").click(function() {

View File

@ -37,6 +37,8 @@
</button> </button>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% settings_value 'BARCODE_ENABLE' as barcodes %}
{% if barcodes %}
<!-- Barcode actions menu --> <!-- Barcode actions menu -->
{% if location %} {% if location %}
<div class='btn-group'> <div class='btn-group'>
@ -47,29 +49,30 @@
<li><a href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li> <li><a href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li>
</ul> </ul>
</div> </div>
<!-- Check permissions and owner --> {% endif %}
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} <!-- Check permissions and owner -->
{% if roles.stock.change %} {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %}
<div class='btn-group'> {% if roles.stock.change %}
<button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button> <div class='btn-group'>
<ul class='dropdown-menu' role='menu'> <button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
<li><a href='#' id='location-count'><span class='fas fa-clipboard-list'></span> <ul class='dropdown-menu' role='menu'>
{% trans "Count stock" %}</a></li> <li><a href='#' id='location-count'><span class='fas fa-clipboard-list'></span>
</ul> {% trans "Count stock" %}</a></li>
</div> </ul>
{% endif %} </div>
{% if roles.stock_location.change %}
<div class='btn-group'>
<button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
<li><a href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li>
{% if roles.stock.delete %}
<li><a href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endif %} {% endif %}
{% if roles.stock_location.change %}
<div class='btn-group'>
<button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
<li><a href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li>
{% if roles.stock.delete %}
<li><a href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endif %}
{% endif %} {% endif %}
</div> </div>
</div> </div>