mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
barcode.js
This commit is contained in:
parent
7d4945d302
commit
2112c6a9ad
@ -3,18 +3,23 @@
|
|||||||
/* globals
|
/* globals
|
||||||
imageHoverIcon,
|
imageHoverIcon,
|
||||||
inventreePut,
|
inventreePut,
|
||||||
|
makeIconButton,
|
||||||
modalEnable,
|
modalEnable,
|
||||||
modalSetContent,
|
modalSetContent,
|
||||||
modalSetTitle,
|
modalSetTitle,
|
||||||
|
modalSetSubmitText,
|
||||||
modalShowSubmitButton,
|
modalShowSubmitButton,
|
||||||
modalSubmit,
|
modalSubmit,
|
||||||
showAlertOrCache,
|
showAlertOrCache,
|
||||||
|
showQuestionDialog,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* exported
|
/* exported
|
||||||
|
barcodeCheckIn,
|
||||||
barcodeScanDialog,
|
barcodeScanDialog,
|
||||||
linkBarcodeDialog,
|
linkBarcodeDialog,
|
||||||
barcodeCheckIn,
|
scanItemsIntoLocation,
|
||||||
|
unlinkBarcode,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function makeBarcodeInput(placeholderText='', hintText='') {
|
function makeBarcodeInput(placeholderText='', hintText='') {
|
||||||
@ -297,7 +302,7 @@ function barcodeScanDialog() {
|
|||||||
/*
|
/*
|
||||||
* Dialog for linking a particular barcode to a stock item.
|
* Dialog for linking a particular barcode to a stock item.
|
||||||
*/
|
*/
|
||||||
function linkBarcodeDialog(stockitem, options={}) {
|
function linkBarcodeDialog(stockitem) {
|
||||||
|
|
||||||
var modal = '#modal-form';
|
var modal = '#modal-form';
|
||||||
|
|
||||||
@ -308,7 +313,7 @@ function linkBarcodeDialog(stockitem, options={}) {
|
|||||||
data: {
|
data: {
|
||||||
stockitem: stockitem,
|
stockitem: stockitem,
|
||||||
},
|
},
|
||||||
onScan: function(response) {
|
onScan: function() {
|
||||||
|
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
location.reload();
|
location.reload();
|
||||||
@ -341,7 +346,7 @@ function unlinkBarcode(stockitem) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
success: function(response, status) {
|
success: function() {
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -355,7 +360,7 @@ function unlinkBarcode(stockitem) {
|
|||||||
/*
|
/*
|
||||||
* Display dialog to check multiple stock items in to a stock location.
|
* Display dialog to check multiple stock items in to a stock location.
|
||||||
*/
|
*/
|
||||||
function barcodeCheckIn(location_id, options={}) {
|
function barcodeCheckIn(location_id) {
|
||||||
|
|
||||||
var modal = '#modal-form';
|
var modal = '#modal-form';
|
||||||
|
|
||||||
@ -447,7 +452,9 @@ function barcodeCheckIn(location_id, options={}) {
|
|||||||
|
|
||||||
// Called when the 'check-in' button is pressed
|
// Called when the 'check-in' button is pressed
|
||||||
|
|
||||||
var data = {location: location_id};
|
var data = {
|
||||||
|
location: location_id
|
||||||
|
};
|
||||||
|
|
||||||
// Extract 'notes' field
|
// Extract 'notes' field
|
||||||
data.notes = $(modal + ' #notes').val();
|
data.notes = $(modal + ' #notes').val();
|
||||||
@ -484,7 +491,7 @@ function barcodeCheckIn(location_id, options={}) {
|
|||||||
},
|
},
|
||||||
onScan: function(response) {
|
onScan: function(response) {
|
||||||
if ('stockitem' in response) {
|
if ('stockitem' in response) {
|
||||||
stockitem = response.stockitem;
|
var stockitem = response.stockitem;
|
||||||
|
|
||||||
var duplicate = false;
|
var duplicate = false;
|
||||||
|
|
||||||
@ -542,12 +549,12 @@ function scanItemsIntoLocation(item_id_list, options={}) {
|
|||||||
function updateLocationInfo(location) {
|
function updateLocationInfo(location) {
|
||||||
var div = $(modal + ' #header-div');
|
var div = $(modal + ' #header-div');
|
||||||
|
|
||||||
if (stock_location && stock_location.pk) {
|
if (location && location.pk) {
|
||||||
div.html(`
|
div.html(`
|
||||||
<div class='alert alert-block alert-info'>
|
<div class='alert alert-block alert-info'>
|
||||||
<b>{% trans "Location" %}</b></br>
|
<b>{% trans "Location" %}</b></br>
|
||||||
${stock_location.name}<br>
|
${location.name}<br>
|
||||||
<i>${stock_location.description}</i>
|
<i>${location.description}</i>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user