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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-25 / +28 lines)
Lines 1383-1393 Link Here
1383
                    itemSelectionBuildActionLinks(div);
1383
                    itemSelectionBuildActionLinks(div);
1384
                });
1384
                });
1385
1385
1386
                $("input[name='itemnumber'][type='checkbox']").change(function() {
1387
                    var div = $(this).parents('table').parent().parent().attr("id");
1388
                    itemSelectionBuildActionLinks(div);
1389
                });
1390
1391
                $(".SelectAll").on("click",function(e){
1386
                $(".SelectAll").on("click",function(e){
1392
                    e.preventDefault();
1387
                    e.preventDefault();
1393
                    var tab = $(this).data("tab");
1388
                    var tab = $(this).data("tab");
Lines 1404-1423 Link Here
1404
1399
1405
                $(".show_filters").on("click",function(e){
1400
                $(".show_filters").on("click",function(e){
1406
                    e.preventDefault();
1401
                    e.preventDefault();
1407
                    let tab = $(this).data("tab");
1402
                    let tab_id = $(this).data("tab");
1408
                    $("#"+tab).find(".show_filters").hide();
1403
                    let tab = $("#"+tab_id);
1409
                    $("#"+tab).find(".hide_filters").show();
1404
                    tab.find(".show_filters").hide();
1410
                    $("#"+tab+"_table thead tr:eq(1)").remove();
1405
                    tab.find(".hide_filters").show();
1411
                    build_items_table(tab+"_table", true, { dom: dataTablesDefaults.dom, destroy: true } );
1406
                    $("#"+tab_id+"_table thead tr:eq(1)").remove();
1407
                    build_items_table(tab_id, true, { dom: dataTablesDefaults.dom, destroy: true } );
1412
                });
1408
                });
1413
1409
1414
                $(".hide_filters").on("click",function(e){
1410
                $(".hide_filters").on("click",function(e){
1415
                    e.preventDefault();
1411
                    e.preventDefault();
1416
                    let tab = $(this).data("tab");
1412
                    let tab_id = $(this).data("tab");
1417
                    $("#"+tab).find(".hide_filters").hide();
1413
                    let tab = $("#"+tab_id);
1418
                    $("#"+tab).find(".show_filters").show();
1414
                    tab.find(".hide_filters").hide();
1419
                    $("#"+tab+"_table thead tr:eq(1)").remove();
1415
                    tab.find(".show_filters").show();
1420
                    build_items_table(tab+"_table", false, { dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', destroy: true } );
1416
                    $("#"+tab_id+"_table thead tr:eq(1)").remove();
1417
                    build_items_table(tab_id, false, { dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', destroy: true } );
1421
                });
1418
                });
1422
            });
1419
            });
1423
        [% END %]
1420
        [% END %]
Lines 1862-1870 Link Here
1862
            // End bundle handling
1859
            // End bundle handling
1863
            [% END %]
1860
            [% END %]
1864
1861
1865
            let items_table_ids = [ 'holdings_table', 'otherholdings_table' ];
1862
            let items_tab_ids = [ 'holdings', 'otherholdings' ];
1866
            items_table_ids.forEach( function( table_id, index ) {
1863
            items_tab_ids.forEach( function( tab_id, index ) {
1867
                build_items_table(table_id, false, { dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>' });
1864
                build_items_table(tab_id, false, { dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>' });
1868
1865
1869
                [% IF bundlesEnabled %]
1866
                [% IF bundlesEnabled %]
1870
                // Add event listener for opening and closing bundle details
1867
                // Add event listener for opening and closing bundle details
Lines 2203-2219 Link Here
2203
        [% END %]
2200
        [% END %]
2204
2201
2205
        let items_table_settings = {
2202
        let items_table_settings = {
2206
            holdings_table: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
2203
            holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
2207
            otherholdings_table: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
2204
            otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
2208
        };
2205
        };
2209
2206
2210
        function build_items_table (table_id, add_filters, dt_options) {
2207
        function build_items_table (tab_id, add_filters, dt_options) {
2211
2208
2212
            let default_filters = {};
2209
            let default_filters = {};
2213
            [% IF Koha.Preference('SeparateHoldings') %]
2210
            [% IF Koha.Preference('SeparateHoldings') %]
2214
                [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
2211
                [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
2215
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
2212
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
2216
                if ( table_id == 'holdings_table' ) {
2213
                if ( tab_id == 'holdings' ) {
2217
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
2214
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
2218
                } else {
2215
                } else {
2219
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
2216
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
Lines 2223-2229 Link Here
2223
            [% IF hidden_count %]
2220
            [% IF hidden_count %]
2224
                default_filters.lost_status = "0";
2221
                default_filters.lost_status = "0";
2225
            [% END %]
2222
            [% END %]
2226
            var items_table = $("#" + table_id).kohaTable({
2223
            var items_table = $("#" + tab_id + '_table').kohaTable({
2227
                ajax: { url: item_table_url },
2224
                ajax: { url: item_table_url },
2228
                order: [[ 0, "asc" ]],
2225
                order: [[ 0, "asc" ]],
2229
                embed,
2226
                embed,
Lines 2687-2699 Link Here
2687
                            table.columns(i).visible(false);
2684
                            table.columns(i).visible(false);
2688
                        }
2685
                        }
2689
                    });
2686
                    });
2687
                    itemSelectionBuildActionLinks(tab_id);
2688
                },
2689
                drawCallback: function(settings){
2690
                    $(this).find("td:first input[name='itemnumber'][type='checkbox']").on("change", function(){
2691
                        itemSelectionBuildActionLinks(tab_id);
2692
                    });
2690
                },
2693
                },
2691
                ...dt_options,
2694
                ...dt_options,
2692
            },
2695
            },
2693
            items_table_settings[table_id],
2696
            items_table_settings[tab_id],
2694
            add_filters,
2697
            add_filters,
2695
            default_filters,
2698
            default_filters,
2696
            );
2699
            );
2700
2697
            return items_table;
2701
            return items_table;
2698
        }
2702
        }
2699
    </script>
2703
    </script>
2700
- 

Return to bug 33568