|
Lines 61-66
Link Here
|
| 61 |
</span> |
61 |
</span> |
| 62 |
<button class="btn btn-link SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</button> |
62 |
<button class="btn btn-link SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</button> |
| 63 |
<button class="btn btn-link ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</button> |
63 |
<button class="btn btn-link ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</button> |
|
|
64 |
<button class="btn btn-link GroupByStatus" data-tab="[% tab | html %]"><i class="fa fa-object-group"></i> Group by status</button> |
| 64 |
<span class="itemselection_actions"> |
65 |
<span class="itemselection_actions"> |
| 65 |
| Actions: |
66 |
| Actions: |
| 66 |
[% IF CAN_user_tools_items_batchdel %] |
67 |
[% IF CAN_user_tools_items_batchdel %] |
|
Lines 255-261
Link Here
|
| 255 |
[%# FIXME The X-Base-Total-Count will be the number of items of the biblios %] |
256 |
[%# FIXME The X-Base-Total-Count will be the number of items of the biblios %] |
| 256 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
257 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
| 257 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
258 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
| 258 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
|
|
| 259 |
let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
259 |
let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
| 260 |
[% IF Koha.Preference('LocalCoverImages') %] |
260 |
[% IF Koha.Preference('LocalCoverImages') %] |
| 261 |
embed.push('cover_image_ids'); |
261 |
embed.push('cover_image_ids'); |
|
Lines 307-312
Link Here
|
| 307 |
[% END %] |
307 |
[% END %] |
| 308 |
}; |
308 |
}; |
| 309 |
|
309 |
|
|
|
310 |
let group_by_status_values = { |
| 311 |
holdings: false, |
| 312 |
otherholdings: false, |
| 313 |
}; |
| 314 |
$(".GroupByStatus").on("click",function(e){ |
| 315 |
e.preventDefault(); |
| 316 |
let tab_id = $(this).data("tab"); |
| 317 |
let was_grouped = group_by_status_values[tab_id]; |
| 318 |
group_by_status_values[tab_id] = !was_grouped; |
| 319 |
|
| 320 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); |
| 321 |
|
| 322 |
if ( was_grouped ) { |
| 323 |
$(this).html('<i class="fa fa-object-group"></i> Group by status</button>'); |
| 324 |
} else { |
| 325 |
$(this).html('<i class="fa fa-object-ungroup"></i> Ungroup by status</button>'); |
| 326 |
} |
| 327 |
}); |
| 328 |
|
| 310 |
function build_items_table (tab_id, add_filters, dt_options, drawcallback) { |
329 |
function build_items_table (tab_id, add_filters, dt_options, drawcallback) { |
| 311 |
|
330 |
|
| 312 |
let table_dt; |
331 |
let table_dt; |
|
Lines 358-365
Link Here
|
| 358 |
return $("#" + tab_id + "_status select").val(); |
377 |
return $("#" + tab_id + "_status select").val(); |
| 359 |
}; |
378 |
}; |
| 360 |
|
379 |
|
|
|
380 |
let offset = 2; |
| 381 |
[% UNLESS Koha.Preference('LocalCoverImages') %]offset--;[% END %] |
| 382 |
let filters_options = { |
| 383 |
[offset] : () => all_item_types, |
| 384 |
[offset+1] : () => all_libraries, |
| 385 |
[offset+2] : () => all_libraries, |
| 386 |
[offset+7] : () => all_statuses, |
| 387 |
}; |
| 388 |
|
| 389 |
let group_by_status = function(){ |
| 390 |
if ( group_by_status_values[tab_id] ) { |
| 391 |
return 'group_by_status=1'; |
| 392 |
} |
| 393 |
return ''; |
| 394 |
} |
| 395 |
|
| 361 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
396 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
| 362 |
ajax: { url: item_table_url }, |
397 |
ajax: { url: "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?" + group_by_status() }, |
| 363 |
order: [], |
398 |
order: [], |
| 364 |
embed, |
399 |
embed, |
| 365 |
autoWidth: false, |
400 |
autoWidth: false, |
| 366 |
- |
|
|