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 1284-1298
Link Here
|
1284 |
|
1286 |
|
1285 |
// item bundles |
1287 |
// item bundles |
1286 |
$('#verify-items-bundle-contents-barcodes').on('input', function (ev) { |
1288 |
$('#verify-items-bundle-contents-barcodes').on('input', function (ev) { |
1287 |
const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() }); |
1289 |
let char = ev.target.value.slice(-1); |
1288 |
$('#items-bundle-contents-table tr').each(function () { |
1290 |
if ( char.match(/\n/) ) { |
1289 |
const barcode = this.getAttribute('data-barcode'); |
1291 |
const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() }); |
1290 |
if (barcodes.includes(barcode)) { |
1292 |
const expected = []; |
1291 |
this.classList.add('ok'); |
1293 |
$('#items-bundle-contents-table tr').each(function () { |
|
|
1294 |
const barcode = this.getAttribute('data-barcode'); |
1295 |
expected.push(barcode); |
1296 |
if (barcodes.includes(barcode)) { |
1297 |
this.classList.add('ok'); |
1298 |
} else { |
1299 |
this.classList.remove('ok'); |
1300 |
} |
1301 |
}); |
1302 |
const last = barcodes[barcodes.length -2]; |
1303 |
const feedback = $('#bundle-feedback'); |
1304 |
let string; |
1305 |
if ( !expected.includes(last) ) { |
1306 |
feedback.fadeOut(100, function(){ |
1307 |
string = _("Unexpected: ") +last; |
1308 |
feedback.addClass('alert-danger').removeClass('alert-success').html(string).fadeIn(100); |
1309 |
}); |
1292 |
} else { |
1310 |
} else { |
1293 |
this.classList.remove('ok'); |
1311 |
feedback.fadeOut(100, function(){ |
|
|
1312 |
string = _("Varified: ")+last; |
1313 |
feedback.addClass('alert-success').removeClass('alert-danger').html(string).fadeIn(100); |
1314 |
}); |
1294 |
} |
1315 |
} |
1295 |
}) |
1316 |
} |
1296 |
}); |
1317 |
}); |
1297 |
|
1318 |
|
1298 |
$('.bundle_remove').on('click', function() { |
1319 |
$('.bundle_remove').on('click', function() { |
1299 |
- |
|
|