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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-24 / +52 lines)
Lines 318-325 Link Here
318
    [% items_table_block_iter = items_table_block_iter + 1 %]
318
    [% items_table_block_iter = items_table_block_iter + 1 %]
319
    <div class="[% tab | html %]_table_table_controls">
319
    <div class="[% tab | html %]_table_table_controls">
320
        [% IF (StaffDetailItemSelection) %]
320
        [% IF (StaffDetailItemSelection) %]
321
            | <a href="#" class="SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a> |
321
            <span class="show_hide_filters">
322
            <a href="#" class="ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</a>
322
                <a href="#" class="show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</a>
323
                <a href="#" class="hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</a>
324
            </span>
325
            | <a href="#" class="SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a>
326
            | <a href="#" class="ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</a>
323
            <span class="itemselection_actions">
327
            <span class="itemselection_actions">
324
              | Actions:
328
              | Actions:
325
              [% IF CAN_user_tools_items_batchdel %]
329
              [% IF CAN_user_tools_items_batchdel %]
Lines 1397-1402 Link Here
1397
                    $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false);
1401
                    $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false);
1398
                    itemSelectionBuildActionLinks(tab);
1402
                    itemSelectionBuildActionLinks(tab);
1399
                });
1403
                });
1404
1405
                $(".show_filters").on("click",function(e){
1406
                    e.preventDefault();
1407
                    let tab = $(this).data("tab");
1408
                    $("#"+tab).find(".show_filters").hide();
1409
                    $("#"+tab).find(".hide_filters").show();
1410
                    $("#"+tab+"_table thead tr:eq(1)").remove();
1411
                    build_items_table(tab+"_table", true, { dom: dataTablesDefaults.dom, destroy: true } );
1412
                });
1413
1414
                $(".hide_filters").on("click",function(e){
1415
                    e.preventDefault();
1416
                    let tab = $(this).data("tab");
1417
                    $("#"+tab).find(".hide_filters").hide();
1418
                    $("#"+tab).find(".show_filters").show();
1419
                    $("#"+tab+"_table thead tr:eq(1)").remove();
1420
                    build_items_table(tab+"_table", false, { dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', destroy: true } );
1421
                });
1400
            });
1422
            });
1401
        [% END %]
1423
        [% END %]
1402
1424
Lines 1532-1537 Link Here
1532
        var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1554
        var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1533
        var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1555
        var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1534
        [% END %]
1556
        [% END %]
1557
1535
        $(document).ready(function() {
1558
        $(document).ready(function() {
1536
1559
1537
            [% IF bundlesEnabled %] // Bundle handling
1560
            [% IF bundlesEnabled %] // Bundle handling
Lines 1839-1859 Link Here
1839
            // End bundle handling
1862
            // End bundle handling
1840
            [% END %]
1863
            [% END %]
1841
1864
1842
            var table_ids = [ 'holdings_table', 'otherholdings_table' ];
1865
            let items_table_ids = [ 'holdings_table', 'otherholdings_table' ];
1843
            var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %] ];
1866
            items_table_ids.forEach( function( table_id, index ) {
1844
            table_ids.forEach( function( table_id, index ) {
1867
                build_items_table(table_id, false, { dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>' });
1845
                let filters = {};
1846
                [% IF Koha.Preference('SeparateHoldings') %]
1847
                    [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
1848
                    let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]home_library_id[% ELSE %]holding_library_id[% END %]';
1849
                    if ( table_id == 'holdings_table' ) {
1850
                        filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
1851
                    } else {
1852
                        filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
1853
                    }
1854
                [% END %]
1855
1856
                var table = build_table(table_id, table_settings[index], filters);
1857
1868
1858
                [% IF bundlesEnabled %]
1869
                [% IF bundlesEnabled %]
1859
                // Add event listener for opening and closing bundle details
1870
                // Add event listener for opening and closing bundle details
Lines 2191-2206 Link Here
2191
            embed.push('course_item.course_reserves.course');
2202
            embed.push('course_item.course_reserves.course');
2192
        [% END %]
2203
        [% END %]
2193
2204
2194
        function build_table (table_id, table_settings, filters) {
2205
        let items_table_settings = {
2206
            holdings_table: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
2207
            otherholdings_table: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
2208
        };
2209
2210
        function build_items_table (table_id, add_filters, dt_options) {
2211
2212
            let default_filters = {};
2213
            [% IF Koha.Preference('SeparateHoldings') %]
2214
                [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
2215
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
2216
                if ( table_id == 'holdings_table' ) {
2217
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
2218
                } else {
2219
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
2220
                }
2221
            [% END %]
2222
2195
            [% IF hidden_count %]
2223
            [% IF hidden_count %]
2196
                filters.lost_status = "0";
2224
                default_filters.lost_status = "0";
2197
            [% END %]
2225
            [% END %]
2198
            var items_table = $("#" + table_id).kohaTable({
2226
            var items_table = $("#" + table_id).kohaTable({
2199
                ajax: { url: item_table_url },
2227
                ajax: { url: item_table_url },
2200
                order: [[ 0, "asc" ]],
2228
                order: [[ 0, "asc" ]],
2201
                embed,
2229
                embed,
2202
                autoWidth: false,
2230
                autoWidth: false,
2203
                bKohaColumnsUseNames: true, // FIXME We should not need that now, do we?
2231
                bKohaColumnsUseNames: true,
2204
                columns: [
2232
                columns: [
2205
                [% IF (StaffDetailItemSelection) %]
2233
                [% IF (StaffDetailItemSelection) %]
2206
                {
2234
                {
Lines 2660-2669 Link Here
2660
                        }
2688
                        }
2661
                    });
2689
                    });
2662
                },
2690
                },
2691
                ...dt_options,
2663
            },
2692
            },
2664
            table_settings,
2693
            items_table_settings[table_id],
2665
            true,
2694
            add_filters,
2666
            filters,
2695
            default_filters,
2667
            );
2696
            );
2668
            return items_table;
2697
            return items_table;
2669
        }
2698
        }
2670
- 

Return to bug 33568