View | Details | Raw Unified | Return to bug 28854
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-8 / +28 lines)
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 1492-1506 Link Here
1492
1494
1493
            // item bundles
1495
            // item bundles
1494
            $('#verify-items-bundle-contents-barcodes').on('input', function (ev) {
1496
            $('#verify-items-bundle-contents-barcodes').on('input', function (ev) {
1495
                const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() });
1497
                let char = ev.target.value.slice(-1);
1496
                $('#items-bundle-contents-table tr').each(function () {
1498
                if ( char.match(/\n/) ) {
1497
                    const barcode = this.getAttribute('data-barcode');
1499
                    const barcodes = ev.target.value.split('\n').map(function(s) { return s.trim() });
1498
                    if (barcodes.includes(barcode)) {
1500
                    const expected = [];
1499
                        this.classList.add('ok');
1501
                    $('#items-bundle-contents-table tr').each(function () {
1502
                        const barcode = this.getAttribute('data-barcode');
1503
                        expected.push(barcode);
1504
                        if (barcodes.includes(barcode)) {
1505
                            this.classList.add('ok');
1506
                        } else {
1507
                            this.classList.remove('ok');
1508
                        }
1509
                    });
1510
                    const last = barcodes[barcodes.length -2];
1511
                    const feedback = $('#bundle-feedback');
1512
                    let string;
1513
                    if ( !expected.includes(last) ) {
1514
                        feedback.fadeOut(100, function(){
1515
                            string = _("Unexpected: ") +last;
1516
                            feedback.addClass('alert-danger').removeClass('alert-success').html(string).fadeIn(100);
1517
                        });
1500
                    } else {
1518
                    } else {
1501
                        this.classList.remove('ok');
1519
                        feedback.fadeOut(100, function(){
1520
                            string = _("Varified: ")+last;
1521
                            feedback.addClass('alert-success').removeClass('alert-danger').html(string).fadeIn(100);
1522
                        });
1502
                    }
1523
                    }
1503
                })
1524
                }
1504
            });
1525
            });
1505
1526
1506
            $('.bundle_remove').on('click', function() {
1527
            $('.bundle_remove').on('click', function() {
1507
- 

Return to bug 28854