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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-43 / +43 lines)
Lines 1260-1265 Link Here
1260
    [% Asset.js("js/recalls.js") | $raw %]
1260
    [% Asset.js("js/recalls.js") | $raw %]
1261
    [% Asset.js("js/coce.js") | $raw %]
1261
    [% Asset.js("js/coce.js") | $raw %]
1262
    [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1262
    [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1263
1264
    [%# The following PROCESS needs: %]
1265
    [%# can_edit_items_from item_type_image_locations %]
1266
    [% PROCESS build_items_table_js biblio => biblio %]
1267
1263
    [% IF ( Koha.Preference('CatalogConcerns') ) %]
1268
    [% IF ( Koha.Preference('CatalogConcerns') ) %]
1264
        <script>
1269
        <script>
1265
            /* Set a variable needed by add_catalog_concern.js */
1270
            /* Set a variable needed by add_catalog_concern.js */
Lines 1723-1728 Link Here
1723
            var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1728
            var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1724
        [% END %]
1729
        [% END %]
1725
1730
1731
        let items_tab_ids = [ 'holdings', 'otherholdings' ];
1732
        items_tab_ids.forEach( function( tab_id, index ) {
1733
1734
            // Early return if the tab is not shown (ie. no table)
1735
            if (!$("#%s-tab".format(tab_id)).length) return;
1736
            [% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
1737
                build_items_table(tab_id, true, {}, build_items_table_drawncallback);
1738
            [% ELSE %]
1739
                build_items_table(tab_id, false, {}, build_items_table_drawncallback);
1740
            [% END %]
1741
1742
            [% IF bundlesEnabled %]
1743
                // Add event listener for opening and closing bundle details
1744
                $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1745
                    var button = $(this);
1746
                    var tr = button.closest('tr');
1747
                    var dTable = button.closest('table').DataTable({ 'retrieve': true });
1748
1749
                    let row = dTable.row( tr );
1750
                    let data = row.data();
1751
                    let itemnumber = data.item_id;
1752
                    let duedate = (data.checkout&&data.checkout.due_date) || null;
1753
1754
                    if ( row.child.isShown() ) {
1755
                        // This row is already open - close it
1756
                        row.child.hide();
1757
                        tr.removeClass('shown');
1758
                        button.removeClass('active');
1759
                    } else {
1760
                        // Open this row
1761
                        createChild(row, itemnumber, duedate);
1762
                        tr.addClass('shown');
1763
                        button.addClass('active');
1764
                    }
1765
                });
1766
            [% END # /IF bundlesEnabled %]
1767
        });
1768
1726
        $(document).ready(function() {
1769
        $(document).ready(function() {
1727
            [% IF bundlesEnabled %] // Bundle handling
1770
            [% IF bundlesEnabled %] // Bundle handling
1728
                function createChild ( row, itemnumber, duedate ) {
1771
                function createChild ( row, itemnumber, duedate ) {
Lines 2034-2077 Link Here
2034
                // End bundle handling
2077
                // End bundle handling
2035
            [% END # /IF bundlesEnabled %]
2078
            [% END # /IF bundlesEnabled %]
2036
2079
2037
            let items_tab_ids = [ 'holdings', 'otherholdings' ];
2038
            items_tab_ids.forEach( function( tab_id, index ) {
2039
2040
                // Early return if the tab is not shown (ie. no table)
2041
                if (!$("#%s-tab".format(tab_id)).length) return;
2042
                [% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
2043
                    build_items_table(tab_id, true, {}, build_items_table_drawncallback);
2044
                [% ELSE %]
2045
                    build_items_table(tab_id, false, {}, build_items_table_drawncallback);
2046
                [% END %]
2047
2048
                [% IF bundlesEnabled %]
2049
                    // Add event listener for opening and closing bundle details
2050
                    $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
2051
                        var button = $(this);
2052
                        var tr = button.closest('tr');
2053
                        var dTable = button.closest('table').DataTable({ 'retrieve': true });
2054
2055
                        let row = dTable.row( tr );
2056
                        let data = row.data();
2057
                        let itemnumber = data.item_id;
2058
                        let duedate = (data.checkout&&data.checkout.due_date) || null;
2059
2060
                        if ( row.child.isShown() ) {
2061
                            // This row is already open - close it
2062
                            row.child.hide();
2063
                            tr.removeClass('shown');
2064
                            button.removeClass('active');
2065
                        } else {
2066
                            // Open this row
2067
                            createChild(row, itemnumber, duedate);
2068
                            tr.addClass('shown');
2069
                            button.addClass('active');
2070
                        }
2071
                    });
2072
                [% END # /IF bundlesEnabled %]
2073
            });
2074
2075
            [% IF Koha.Preference('AcquisitionDetails') %]
2080
            [% IF Koha.Preference('AcquisitionDetails') %]
2076
                var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2081
                var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2077
                var acquisitiondetails_table = $("#orders").kohaTable(
2082
                var acquisitiondetails_table = $("#orders").kohaTable(
Lines 2358-2367 Link Here
2358
            return confirm( _("Are you sure you want to delete this comment?") );
2363
            return confirm( _("Are you sure you want to delete this comment?") );
2359
        });
2364
        });
2360
    </script>
2365
    </script>
2361
    [%# The following PROCESS needs: %]
2362
    [%# can_edit_items_from item_type_image_locations %]
2363
    [% PROCESS build_items_table_js biblio => biblio %]
2364
2365
    [% CoverImagePlugins | $raw %]
2366
    [% CoverImagePlugins | $raw %]
2366
[% END # /jsinclude %]
2367
[% END # /jsinclude %]
2367
[% INCLUDE 'intranet-bottom.inc' %]
2368
[% INCLUDE 'intranet-bottom.inc' %]
2368
- 

Return to bug 40127