Bug 28854: Add count of scanned items to verification modal

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2021-11-26 10:21:08 +00:00 committed by Tomas Cohen Arazi
parent 830a26e294
commit 1812d03e55
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 6 additions and 1 deletions

View File

@ -472,7 +472,7 @@
</table>
<div class="form-group">
<label for="verify-items-bundle-contents-barcodes">Barcodes</label>
<label for="verify-items-bundle-contents-barcodes">Barcodes <span id="verify-progress" class="pull-right" style="display: none"><span id="verified">0</span> of <span id="expected"></span> verified</span></label>
<textarea autocomplete="off" id="verify-items-bundle-contents-barcodes" name="verify-items-bundle-contents-barcodes" class="form-control"></textarea>
[% IF item.onloan %]
<div class="help-block">[% t('Scan all barcodes of items found in the items bundle. If any items are missing, they will be marked as lost') | html %]</div>
@ -1496,11 +1496,13 @@
if ( char.match(/\n/) ) {
const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() });
const expected = [];
let found = 0;
$('#items-bundle-contents-table tr').each(function () {
const barcode = this.getAttribute('data-barcode');
expected.push(barcode);
if (barcodes.includes(barcode)) {
this.classList.add('ok');
found++;
} else {
this.classList.remove('ok');
}
@ -1519,6 +1521,9 @@
feedback.addClass('alert-success').removeClass('alert-danger').html(string).fadeIn(100);
});
}
$('#verify-progress').show();
$('#verified').text(found);
$('#expected').text(expected.length);
}
});