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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-3 / +16 lines)
Lines 1-5 Link Here
1
[% USE To %]
1
[% USE To %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Branches %]
3
[% USE AuthorisedValues %]
4
[% USE AuthorisedValues %]
4
[% USE raw %]
5
[% USE raw %]
5
6
Lines 164-169 Link Here
164
    [% END %]
165
    [% END %]
165
166
166
167
168
    const all_libraries = [% To.json(Branches.all) | $raw %];
169
    const libraries_filters = all_libraries.map(e => {
170
                e["_id"] = e["branchcode"];
171
                e["_str"] = e["branchname"];
172
                return e;
173
            });
174
167
    const can_edit_items_from = [% To.json(can_edit_items_from || {}) | $raw %];
175
    const can_edit_items_from = [% To.json(can_edit_items_from || {}) | $raw %];
168
    const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
176
    const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
169
    const av_loc = new Map([% To.json(AuthorisedValues.Get('LOC')) | $raw %].map( av => [av.authorised_value, av.lib]));
177
    const av_loc = new Map([% To.json(AuthorisedValues.Get('LOC')) | $raw %].map( av => [av.authorised_value, av.lib]));
Lines 185-191 Link Here
185
    [%# Do we need separate/new endpoints or do we hack the somewhere client-side? %]
193
    [%# Do we need separate/new endpoints or do we hack the somewhere client-side? %]
186
    let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
194
    let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
187
    let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk,item_type"];
195
    let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk,item_type"];
188
    embed.push('home_library', 'holding_library');
189
    [% IF Koha.Preference('LocalCoverImages') %]
196
    [% IF Koha.Preference('LocalCoverImages') %]
190
        embed.push('cover_image_ids');
197
        embed.push('cover_image_ids');
191
    [% END %]
198
    [% END %]
Lines 248-253 Link Here
248
        if ( !items_selection.hasOwnProperty(tab_id) ){
255
        if ( !items_selection.hasOwnProperty(tab_id) ){
249
            items_selection[tab_id] = [];
256
            items_selection[tab_id] = [];
250
        }
257
        }
258
259
        let filters_options = {
260
            3: () => all_libraries,
261
            4: () => all_libraries,
262
        };
251
        var items_table = $("#" + tab_id + '_table').kohaTable({
263
        var items_table = $("#" + tab_id + '_table').kohaTable({
252
            ajax: { url: item_table_url },
264
            ajax: { url: item_table_url },
253
            order: [[ 0, "asc" ]],
265
            order: [[ 0, "asc" ]],
Lines 320-326 Link Here
320
            },
332
            },
321
            [% END %]
333
            [% END %]
322
            {
334
            {
323
                data: "me.holding_library_id:holding_library.name",
335
                data: "me.holding_library_id",
324
                className: "location",
336
                className: "location",
325
                searchable: true,
337
                searchable: true,
326
                orderable: true,
338
                orderable: true,
Lines 329-335 Link Here
329
                }
341
                }
330
            },
342
            },
331
            {
343
            {
332
                data: "me.home_library_id:home_library.name",
344
                data: "me.home_library_id",
333
                className: "homebranch",
345
                className: "homebranch",
334
                searchable: true,
346
                searchable: true,
335
                orderable: true,
347
                orderable: true,
Lines 768-773 Link Here
768
        items_table_settings[tab_id],
780
        items_table_settings[tab_id],
769
        add_filters,
781
        add_filters,
770
        default_filters,
782
        default_filters,
783
        filters_options,
771
        );
784
        );
772
785
773
        return items_table;
786
        return items_table;
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-3 / +2 lines)
Lines 947-953 function _dt_add_delay(table_dt, table_node, delay_ms) { Link Here
947
    * @param  {Object}  default_filters              Add a set of default search filters to apply at table initialisation
947
    * @param  {Object}  default_filters              Add a set of default search filters to apply at table initialisation
948
    * @return {Object}                               The dataTables instance
948
    * @return {Object}                               The dataTables instance
949
    */
949
    */
950
    $.fn.kohaTable = function(options, table_settings, add_filters, default_filters) {
950
    $.fn.kohaTable = function(options, table_settings, add_filters, default_filters, filters_options) {
951
        var settings = null;
951
        var settings = null;
952
952
953
        if(options) {
953
        if(options) {
Lines 998-1004 function _dt_add_delay(table_dt, table_node, delay_ms) { Link Here
998
998
999
        var table_dt = table.DataTable();
999
        var table_dt = table.DataTable();
1000
        if ( add_filters ) {
1000
        if ( add_filters ) {
1001
            _dt_add_filters(this, table_dt);
1001
            _dt_add_filters(this, table_dt, filters_options);
1002
        }
1002
        }
1003
1003
1004
        table.DataTable().on("column-visibility.dt", function(){_dt_on_visibility(add_filters, table, table_dt);})
1004
        table.DataTable().on("column-visibility.dt", function(){_dt_on_visibility(add_filters, table, table_dt);})
1005
- 

Return to bug 33568