mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
UI fixes for barcode actions (#3751)
* Fix "scan items into location" dialog function * More barcode fixes
This commit is contained in:
parent
d194aef79e
commit
5d6423fb64
@ -43,7 +43,9 @@ function makeBarcodeInput(placeholderText='', hintText='') {
|
|||||||
<span class='fas fa-qrcode'></span>
|
<span class='fas fa-qrcode'></span>
|
||||||
</span>
|
</span>
|
||||||
<input id='barcode' class='textinput textInput form-control' type='text' name='barcode' placeholder='${placeholderText}'>
|
<input id='barcode' class='textinput textInput form-control' type='text' name='barcode' placeholder='${placeholderText}'>
|
||||||
<button id='barcode_scan_btn' class='btn btn-secondary' onclick='onBarcodeScanClicked()' style='display: none;'><span class='fas fa-camera'></span></button>
|
<button id='barcode_scan_btn' type='button' class='btn btn-secondary' onclick='onBarcodeScanClicked()' style='display: none;'>
|
||||||
|
<span class='fas fa-camera'></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id='hint_barcode_data' class='help-block'>${hintText}</div>
|
<div id='hint_barcode_data' class='help-block'>${hintText}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -571,8 +573,13 @@ function barcodeCheckIn(location_id, options={}) {
|
|||||||
},
|
},
|
||||||
onScan: function(response) {
|
onScan: function(response) {
|
||||||
if ('stockitem' in response) {
|
if ('stockitem' in response) {
|
||||||
var stockitem = response.stockitem;
|
var pk = response.stockitem.pk;
|
||||||
|
|
||||||
|
inventreeGet(
|
||||||
|
`/api/stock/${pk}/`,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
success: function(stockitem) {
|
||||||
var duplicate = false;
|
var duplicate = false;
|
||||||
|
|
||||||
items.forEach(function(item) {
|
items.forEach(function(item) {
|
||||||
@ -597,7 +604,9 @@ function barcodeCheckIn(location_id, options={}) {
|
|||||||
|
|
||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// Barcode does not match a stock item
|
// Barcode does not match a stock item
|
||||||
showBarcodeMessage(modal, '{% trans "Barcode does not match Stock Item" %}', 'warning');
|
showBarcodeMessage(modal, '{% trans "Barcode does not match Stock Item" %}', 'warning');
|
||||||
@ -696,12 +705,26 @@ function scanItemsIntoLocation(item_list, options={}) {
|
|||||||
onScan: function(response) {
|
onScan: function(response) {
|
||||||
updateLocationInfo(null);
|
updateLocationInfo(null);
|
||||||
if ('stocklocation' in response) {
|
if ('stocklocation' in response) {
|
||||||
// Barcode corresponds to a StockLocation
|
|
||||||
stock_location = response.stocklocation;
|
var pk = response.stocklocation.pk;
|
||||||
|
|
||||||
|
inventreeGet(`/api/stock/location/${pk}/`, {}, {
|
||||||
|
success: function(response) {
|
||||||
|
|
||||||
|
stock_location = response;
|
||||||
|
|
||||||
updateLocationInfo(stock_location);
|
updateLocationInfo(stock_location);
|
||||||
modalEnable(modal, true);
|
modalEnable(modal, true);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
// Barcode does *NOT* correspond to a StockLocation
|
||||||
|
showBarcodeMessage(
|
||||||
|
modal,
|
||||||
|
'{% trans "Barcode does not match a valid location" %}',
|
||||||
|
'warning',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// Barcode does *NOT* correspond to a StockLocation
|
// Barcode does *NOT* correspond to a StockLocation
|
||||||
showBarcodeMessage(
|
showBarcodeMessage(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user