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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-1 / +117 lines)
Lines 105-110 Link Here
105
        :disabled {
105
        :disabled {
106
            opacity: 0.5;
106
            opacity: 0.5;
107
        }
107
        }
108
        #toolbar {
109
            align-items: center;
110
        }
108
    </style>
111
    </style>
109
[% END %]
112
[% END %]
110
</head>
113
</head>
Lines 1235-1240 Link Here
1235
                            </select>
1238
                            </select>
1236
                        [% END %]
1239
                        [% END %]
1237
                    </fieldset>
1240
                    </fieldset>
1241
                    [% IF ( CAN_user_reserveforothers_alter_hold_targets ) %]
1242
                        <div class="btn-group">
1243
                            <a class="btn btn-default btn-xs dropdown-toggle move_selected_holds" id="item_record_choice" role="button" data-bs-toggle="dropdown" href="#" aria-expanded="false"></a>
1244
                            <ul class="dropdown-menu" role="menu" aria-labelledby="item_record_choice" style="">
1245
                                <li><a class="dropdown-item move_hold_item" href="#">Item level holds to a different item</a></li>
1246
                                <li><a class="dropdown-item move_hold_record" href="#">Record level holds to a different record</a></li>
1247
                            </ul>
1248
                        </div>
1249
                    [% END %]
1238
                </div>
1250
                </div>
1239
                <div class="page-section">
1251
                <div class="page-section">
1240
                    [% FOREACH biblioloo IN biblioloop %]
1252
                    [% FOREACH biblioloo IN biblioloop %]
Lines 1416-1421 Link Here
1416
        </div>
1428
        </div>
1417
    </div>
1429
    </div>
1418
</div>
1430
</div>
1431
<div id="moveHoldItemModal" class="modal modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
1432
    <div class="modal-dialog">
1433
        <div class="modal-content">
1434
            <div class="modal-header">
1435
                <h1 class="modal-title">Move hold(s) to a different item</h1>
1436
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1437
            </div>
1438
            <div class="modal-body">
1439
                <div id="move_hold_item_selection">
1440
                    <h3>Selected holds to move</h3>
1441
                    <table>
1442
                        <thead>
1443
                            <tr>
1444
                                <th>Hold ID</th>
1445
                                <th>Item barcode ( current hold )</th>
1446
                            </tr>
1447
                        </thead>
1448
                        <tbody> </tbody>
1449
                    </table>
1450
                </div>
1451
                <hr />
1452
                <div id="move_hold_item_search" class="alert alert-danger" style="display:none;"></div>
1453
                <form id="searchForm">
1454
                    <div id="move_hold_item_searchform">
1455
                        <fieldset class="action">
1456
                            <h3><label for="external_id">Enter the item barcode of new hold target: </label></h3>
1457
                            <input type="text" class="form-control" name="external_id" id="external_id" required />
1458
                        </fieldset>
1459
                        <button type="submit" class="btn btn-success mt-3">Search</button>
1460
                    </div>
1461
                </form>
1462
                <hr />
1463
                <form id="move_hold_item_form" method="post" action="request.pl">
1464
                    [% INCLUDE 'csrf-token.inc' %]
1465
                    <input type="hidden" name="op" value="cud-move_hold_item" />
1466
                    <div id="resultMessage" class="mt-3"> </div>
1467
                    <button type="submit" class="btn btn-primary mt-3">Move selected holds</button>
1468
                </form>
1469
            </div>
1470
            <div class="modal-footer">
1471
                <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
1472
            </div>
1473
        </div>
1474
    </div>
1475
</div>
1419
<div id="hold-actions">
1476
<div id="hold-actions">
1420
    <form id="hold-actions-form"> [% INCLUDE 'csrf-token.inc' %] </form>
1477
    <form id="hold-actions-form"> [% INCLUDE 'csrf-token.inc' %] </form>
1421
</div>
1478
</div>
Lines 1467-1472 Link Here
1467
        }
1524
        }
1468
1525
1469
        var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
1526
        var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
1527
        var MSG_MOVE_SELECTED = _("Move selected (%s)");
1470
        var MSG_CANCEL_ALERT    = _("This action will cancel <span class='badge'>%s</span> hold(s).");
1528
        var MSG_CANCEL_ALERT    = _("This action will cancel <span class='badge'>%s</span> hold(s).");
1471
        $.fn.select2.defaults.set("width", "100%" );
1529
        $.fn.select2.defaults.set("width", "100%" );
1472
        $.fn.select2.defaults.set("dropdownAutoWidth", true );
1530
        $.fn.select2.defaults.set("dropdownAutoWidth", true );
Lines 1731-1736 Link Here
1731
        }
1789
        }
1732
1790
1733
         $(document).ready(function() {
1791
         $(document).ready(function() {
1792
            $("#searchForm").on("submit", function (event) {
1793
                event.preventDefault();
1794
1795
                let externalID = $("#external_id").val();
1796
                let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`;
1797
1798
                $.ajax({
1799
                    url: apiUrl,
1800
                    method: "GET",
1801
                    dataType: "json",
1802
                    success: function (data) {
1803
                        if (data.length > 0) {
1804
                            let resultHtml = "";
1805
                            $.each(data, function (index, item) {
1806
                                resultHtml += `
1807
                                    <div class="alert alert-success">
1808
                                        <strong>Biblionumber:</strong> ${item.biblio_id} <br>
1809
                                        <strong>Item:</strong> ${item.external_id} <br>
1810
                                        <input id="new_itemnumber_${item.item_id}" name="new_itemnumber" type="checkbox" value="${item.item_id}">
1811
                                        <label for="new_itemnumber_${item.item_id}">Move all selected item level holds to this item</label>
1812
                                        <input id="new_biblionumber_${item.item_id}" name="new_biblionumber" type="hidden" value="${item.biblio_id}">
1813
                                    </div>
1814
                                    <hr />
1815
                                `;
1816
                            });
1817
                            $("#resultMessage").html(resultHtml);
1818
                        } else {
1819
                            $("#resultMessage").html(`
1820
                                <div class="alert alert-warning">No item found with barcode: ${externalID}.</div>
1821
                            `);
1822
                        }
1823
                    },
1824
                });
1825
            });
1826
1827
            $(document).on("change", 'input[name="new_itemnumber"]', function() {
1828
                $('input[name="new_itemnumber"]').not(this).prop("checked", false);
1829
            });
1734
1830
1735
            $("#always_show_holds").change(function(){
1831
            $("#always_show_holds").change(function(){
1736
                if( $(this).prop('checked') ){
1832
                if( $(this).prop('checked') ){
Lines 1834-1839 Link Here
1834
            });
1930
            });
1835
1931
1836
            $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1932
            $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1933
            $('.move_selected_holds').html(MSG_MOVE_SELECTED.format($('.holds_table .select_hold:checked').length));
1837
1934
1838
            $('.holds_table .select_hold_all').click(function() {
1935
            $('.holds_table .select_hold_all').click(function() {
1839
                var table = $(this).parents('.holds_table');
1936
                var table = $(this).parents('.holds_table');
Lines 1841-1846 Link Here
1841
                $('.select_hold', table).prop('checked', !count);
1938
                $('.select_hold', table).prop('checked', !count);
1842
                $(this).prop('checked', !count);
1939
                $(this).prop('checked', !count);
1843
                $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1940
                $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1941
                $('.move_selected_holds').html(MSG_MOVE_SELECTED.format($('.holds_table .select_hold:checked').length));
1844
                $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length));
1942
                $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length));
1845
                $('#cancel_hold_alert').show();
1943
                $('#cancel_hold_alert').show();
1846
                localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1944
                localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
Lines 1851-1861 Link Here
1851
                var count = $('.select_hold:not(:checked)', table).length;
1949
                var count = $('.select_hold:not(:checked)', table).length;
1852
                $('.select_hold_all', table).prop('checked', !count);
1950
                $('.select_hold_all', table).prop('checked', !count);
1853
                $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1951
                $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1952
                $('.move_selected_holds').html(MSG_MOVE_SELECTED.format($('.holds_table .select_hold:checked').length));
1854
                $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length));
1953
                $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length));
1855
                $('#cancel_hold_alert').show();
1954
                $('#cancel_hold_alert').show();
1856
                localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1955
                localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1857
            });
1956
            });
1858
1957
1958
            $('.move_hold_item').click(function(e) {
1959
                e.preventDefault();
1960
                if($('.holds_table .select_hold:checked').length) {
1961
                    $('#moveHoldItemModal #resultMessage').empty();
1962
                    $('#move_hold_item_selection table tbody').empty();
1963
                    $('#moveHoldItemModal').modal('show');
1964
                    $('.select_hold:checked').each( function() {
1965
                        let reserve_id = $(this).data('id');
1966
                        let item_level_hold = $(this).data('item_level_hold');
1967
                        let found_status = $(this).data('found');
1968
                        $('#move_hold_item_selection table').append(`<tr><td>${reserve_id}</td><td></td></tr>`)
1969
                        if ( item_level_hold ) {
1970
                            $('#move_hold_item_form').append(`<input type="hidden" name="hold_id" value="${reserve_id}">`);
1971
                        }
1972
                    });
1973
                }
1974
            });
1975
1859
            $('.cancel_selected_holds').click(function(e) {
1976
            $('.cancel_selected_holds').click(function(e) {
1860
                e.preventDefault();
1977
                e.preventDefault();
1861
                if($('.holds_table .select_hold:checked').length) {
1978
                if($('.holds_table .select_hold:checked').length) {
1862
- 

Return to bug 31698