Bug 28854: Add count of scanned items to verification modal
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 26 Nov 2021 10:21:08 +0000 (10:21 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 13 Jul 2022 13:35:39 +0000 (10:35 -0300)
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>
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

index c41a8b5..4ed6318 100644 (file)
                                             </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>
                 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');
                         }
                             feedback.addClass('alert-success').removeClass('alert-danger').html(string).fadeIn(100);
                         });
                     }
+                    $('#verify-progress').show();
+                    $('#verified').text(found);
+                    $('#expected').text(expected.length);
                 }
             });