Lines 481-486
Link Here
|
481 |
[% END %] |
481 |
[% END %] |
482 |
</div> |
482 |
</div> |
483 |
|
483 |
|
|
|
484 |
<div id="bundle-feedback" class="alert" style="display:none"></div> |
485 |
|
484 |
</div> |
486 |
</div> |
485 |
<div class="modal-footer"> |
487 |
<div class="modal-footer"> |
486 |
<input type="hidden" name="barcode" value="[% item.barcode | html %]"> |
488 |
<input type="hidden" name="barcode" value="[% item.barcode | html %]"> |
Lines 1490-1504
Link Here
|
1490 |
|
1492 |
|
1491 |
// item bundles |
1493 |
// item bundles |
1492 |
$('#verify-items-bundle-contents-barcodes').on('input', function (ev) { |
1494 |
$('#verify-items-bundle-contents-barcodes').on('input', function (ev) { |
1493 |
const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() }); |
1495 |
let char = ev.target.value.slice(-1); |
1494 |
$('#items-bundle-contents-table tr').each(function () { |
1496 |
if ( char.match(/\n/) ) { |
1495 |
const barcode = this.getAttribute('data-barcode'); |
1497 |
const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() }); |
1496 |
if (barcodes.includes(barcode)) { |
1498 |
const expected = []; |
1497 |
this.classList.add('ok'); |
1499 |
$('#items-bundle-contents-table tr').each(function () { |
|
|
1500 |
const barcode = this.getAttribute('data-barcode'); |
1501 |
expected.push(barcode); |
1502 |
if (barcodes.includes(barcode)) { |
1503 |
this.classList.add('ok'); |
1504 |
} else { |
1505 |
this.classList.remove('ok'); |
1506 |
} |
1507 |
}); |
1508 |
const last = barcodes[barcodes.length -2]; |
1509 |
const feedback = $('#bundle-feedback'); |
1510 |
let string; |
1511 |
if ( !expected.includes(last) ) { |
1512 |
feedback.fadeOut(100, function(){ |
1513 |
string = _("Unexpected: ") +last; |
1514 |
feedback.addClass('alert-danger').removeClass('alert-success').html(string).fadeIn(100); |
1515 |
}); |
1498 |
} else { |
1516 |
} else { |
1499 |
this.classList.remove('ok'); |
1517 |
feedback.fadeOut(100, function(){ |
|
|
1518 |
string = _("Varified: ")+last; |
1519 |
feedback.addClass('alert-success').removeClass('alert-danger').html(string).fadeIn(100); |
1520 |
}); |
1500 |
} |
1521 |
} |
1501 |
}) |
1522 |
} |
1502 |
}); |
1523 |
}); |
1503 |
|
1524 |
|
1504 |
$('.bundle_remove').on('click', function() { |
1525 |
$('.bundle_remove').on('click', function() { |
1505 |
- |
|
|