|
Lines 9-15
Link Here
|
| 9 |
[% BLOCK build_table %] |
9 |
[% BLOCK build_table %] |
| 10 |
<table class="items_table" id="[% tab | html %]_table"> |
10 |
<table class="items_table" id="[% tab | html %]_table"> |
| 11 |
<thead> |
11 |
<thead> |
| 12 |
[% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %] |
12 |
<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th> |
| 13 |
[% IF Koha.Preference('LocalCoverImages') %] |
13 |
[% IF Koha.Preference('LocalCoverImages') %] |
| 14 |
<th id="[% tab | html %]_cover_image" data-colname="[% tab | html %]_cover_image">Cover image</th> |
14 |
<th id="[% tab | html %]_cover_image" data-colname="[% tab | html %]_cover_image">Cover image</th> |
| 15 |
[% END %] |
15 |
[% END %] |
|
Lines 51-86
Link Here
|
| 51 |
<button class="btn btn-link show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</button> |
51 |
<button class="btn btn-link show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</button> |
| 52 |
<button class="btn btn-link hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</button> |
52 |
<button class="btn btn-link hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</button> |
| 53 |
</span> |
53 |
</span> |
| 54 |
[% IF (StaffDetailItemSelection) %] |
54 |
<button class="btn btn-link SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</button> |
| 55 |
<button class="btn btn-link SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</button> |
55 |
<button class="btn btn-link ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</button> |
| 56 |
<button class="btn btn-link ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</button> |
56 |
<span class="itemselection_actions"> |
| 57 |
<span class="itemselection_actions"> |
57 |
| Actions: |
| 58 |
| Actions: |
58 |
[% IF CAN_user_tools_items_batchdel %] |
| 59 |
[% IF CAN_user_tools_items_batchdel %] |
59 |
<form class="itemselection_action_delete_form" method="post" action="/cgi-bin/koha/tools/batchMod.pl"> |
| 60 |
<form class="itemselection_action_delete_form" method="post" action="/cgi-bin/koha/tools/batchMod.pl"> |
60 |
[% INCLUDE 'csrf-token.inc' %] |
| 61 |
[% INCLUDE 'csrf-token.inc' %] |
61 |
<input name='src' type='hidden' value='CATALOGUING' /> |
| 62 |
<input name='src' type='hidden' value='CATALOGUING' /> |
62 |
<input name='biblionumber' type='hidden' value="[% biblionumber | html %]" /> |
| 63 |
<input name='biblionumber' type='hidden' value="[% biblionumber | html %]" /> |
63 |
<input name='op' type='hidden' value='cud-show' /> |
| 64 |
<input name='op' type='hidden' value='cud-show' /> |
64 |
<input name='del' type='hidden' value='1' /> |
| 65 |
<input name='del' type='hidden' value='1' /> |
65 |
<button type="submit" class="itemselection_action_delete btn btn-link" /><i class="fa fa-trash-can"></i> Delete selected items</button> |
| 66 |
<button type="submit" class="itemselection_action_delete btn btn-link" /><i class="fa fa-trash-can"></i> Delete selected items</button> |
66 |
</form> |
| 67 |
</form> |
67 |
[% END %] |
| 68 |
[% END %] |
68 |
[% IF CAN_user_tools_items_batchmod %] |
| 69 |
[% IF CAN_user_tools_items_batchmod %] |
69 |
<form class="itemselection_action_modify_form" method="post" action="/cgi-bin/koha/tools/batchMod.pl"> |
| 70 |
<form class="itemselection_action_modify_form" method="post" action="/cgi-bin/koha/tools/batchMod.pl"> |
70 |
[% INCLUDE 'csrf-token.inc' %] |
| 71 |
[% INCLUDE 'csrf-token.inc' %] |
71 |
<input name='src' type='hidden' value='CATALOGUING' /> |
| 72 |
<input name='src' type='hidden' value='CATALOGUING' /> |
72 |
<input name='biblionumber' type='hidden' value="[% biblionumber | html %]" /> |
| 73 |
<input name='biblionumber' type='hidden' value="[% biblionumber | html %]" /> |
73 |
<input name='op' type='hidden' value='cud-show' /> |
| 74 |
<input name='op' type='hidden' value='cud-show' /> |
74 |
<button type="submit" class="itemselection_action_modify btn btn-link" /><i class="fa-solid fa-pencil"></i> Modify selected items</button> |
| 75 |
<button type="submit" class="itemselection_action_modify btn btn-link" /><i class="fa-solid fa-pencil"></i> Modify selected items</button> |
75 |
</form> |
| 76 |
</form> |
76 |
[% END %] |
| 77 |
[% END %] |
77 |
[% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] |
| 78 |
[% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] |
78 |
<a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a> |
| 79 |
<a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a> |
79 |
<a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a> |
| 80 |
<a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a> |
80 |
[% END %] |
| 81 |
[% END %] |
81 |
</span> |
| 82 |
</span> |
|
|
| 83 |
[% END %] |
| 84 |
</div> |
82 |
</div> |
| 85 |
|
83 |
|
| 86 |
[% PROCESS build_table tab => tab %] |
84 |
[% PROCESS build_table tab => tab %] |
|
Lines 91-157
Link Here
|
| 91 |
<script> |
89 |
<script> |
| 92 |
|
90 |
|
| 93 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
91 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
| 94 |
[% IF StaffDetailItemSelection %] |
|
|
| 95 |
|
92 |
|
| 96 |
let items_selection = {}; |
93 |
let items_selection = {}; |
| 97 |
|
94 |
|
| 98 |
function _itemSelectionBuildLink(tab_id, link_class) { |
95 |
function _itemSelectionBuildLink(tab_id, link_class) { |
| 99 |
|
96 |
|
| 100 |
let itemnumbers = items_selection[tab_id]; |
97 |
let itemnumbers = items_selection[tab_id]; |
| 101 |
let tab = $("#" + tab_id + "_panel" ); |
98 |
let tab = $("#" + tab_id + "_panel" ); |
| 102 |
let form = tab.find(link_class); |
99 |
let form = tab.find(link_class); |
| 103 |
$(form).find("input[name='itemnumber']").remove(); |
100 |
$(form).find("input[name='itemnumber']").remove(); |
| 104 |
|
101 |
|
| 105 |
$(itemnumbers).each(function() { |
102 |
$(itemnumbers).each(function() { |
| 106 |
$(form).append("<input name='itemnumber' type='hidden' value='%s'/>".format(this)); |
103 |
$(form).append("<input name='itemnumber' type='hidden' value='%s'/>".format(this)); |
| 107 |
}); |
104 |
}); |
| 108 |
return !!itemnumbers.length |
105 |
return !!itemnumbers.length |
| 109 |
} |
106 |
} |
| 110 |
function itemSelectionBuildDeleteLink(tab_id) { |
107 |
function itemSelectionBuildDeleteLink(tab_id) { |
| 111 |
return _itemSelectionBuildLink(tab_id, '.itemselection_action_delete_form'); |
108 |
return _itemSelectionBuildLink(tab_id, '.itemselection_action_delete_form'); |
| 112 |
} |
109 |
} |
| 113 |
function itemSelectionBuildModifyLink(tab_id) { |
110 |
function itemSelectionBuildModifyLink(tab_id) { |
| 114 |
return _itemSelectionBuildLink(tab_id, '.itemselection_action_modify_form'); |
111 |
return _itemSelectionBuildLink(tab_id, '.itemselection_action_modify_form'); |
| 115 |
} |
112 |
} |
| 116 |
|
113 |
|
| 117 |
function itemSelectionBuildActionLinks(tab_id) { |
114 |
function itemSelectionBuildActionLinks(tab_id) { |
| 118 |
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); |
115 |
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); |
| 119 |
var modify_link_ok = itemSelectionBuildModifyLink(tab_id); |
116 |
var modify_link_ok = itemSelectionBuildModifyLink(tab_id); |
| 120 |
var tab = $("#" + tab_id + "_panel" ); |
117 |
var tab = $("#" + tab_id + "_panel" ); |
| 121 |
if (modify_link_ok || delete_link_ok) { |
118 |
if (modify_link_ok || delete_link_ok) { |
| 122 |
$('.itemselection_actions', tab).show(); |
119 |
$('.itemselection_actions', tab).show(); |
| 123 |
} else { |
120 |
} else { |
| 124 |
$('.itemselection_actions', tab).hide(); |
121 |
$('.itemselection_actions', tab).hide(); |
| 125 |
} |
|
|
| 126 |
} |
122 |
} |
|
|
123 |
} |
| 127 |
|
124 |
|
| 128 |
$(document).ready(function() { |
125 |
$(document).ready(function() { |
| 129 |
|
|
|
| 130 |
$(".SelectAll").on("click",function(e){ |
| 131 |
e.preventDefault(); |
| 132 |
let tab_id = $(this).data("tab"); |
| 133 |
let tab = $("#" + tab_id + "_panel" ); |
| 134 |
items_selection[tab_id] = []; |
| 135 |
tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => { |
| 136 |
let itemnumber = parseInt($(input).val()); |
| 137 |
items_selection[tab_id].push(itemnumber); |
| 138 |
$(input).prop('checked', true); |
| 139 |
}); |
| 140 |
itemSelectionBuildActionLinks(tab_id); |
| 141 |
}); |
| 142 |
|
126 |
|
| 143 |
$(".ClearAll").on("click",function(e){ |
127 |
$(".SelectAll").on("click",function(e){ |
| 144 |
e.preventDefault(); |
128 |
e.preventDefault(); |
| 145 |
let tab_id = $(this).data("tab"); |
129 |
let tab_id = $(this).data("tab"); |
| 146 |
let tab = $("#" + tab_id + "_panel" ); |
130 |
let tab = $("#" + tab_id + "_panel" ); |
| 147 |
items_selection[tab_id] = []; |
131 |
items_selection[tab_id] = []; |
| 148 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
132 |
tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => { |
| 149 |
itemSelectionBuildActionLinks(tab_id); |
133 |
let itemnumber = parseInt($(input).val()); |
|
|
134 |
items_selection[tab_id].push(itemnumber); |
| 135 |
$(input).prop('checked', true); |
| 150 |
}); |
136 |
}); |
|
|
137 |
itemSelectionBuildActionLinks(tab_id); |
| 138 |
}); |
| 151 |
|
139 |
|
|
|
140 |
$(".ClearAll").on("click",function(e){ |
| 141 |
e.preventDefault(); |
| 142 |
let tab_id = $(this).data("tab"); |
| 143 |
let tab = $("#" + tab_id + "_panel" ); |
| 144 |
items_selection[tab_id] = []; |
| 145 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
| 146 |
itemSelectionBuildActionLinks(tab_id); |
| 152 |
}); |
147 |
}); |
| 153 |
[% END %] |
|
|
| 154 |
|
148 |
|
|
|
149 |
}); |
| 155 |
|
150 |
|
| 156 |
$(document).ready(function() { |
151 |
$(document).ready(function() { |
| 157 |
$(".show_filters").on("click",function(e){ |
152 |
$(".show_filters").on("click",function(e){ |
|
Lines 162-170
Link Here
|
| 162 |
tab.find(".hide_filters").show(); |
157 |
tab.find(".hide_filters").show(); |
| 163 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
158 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
| 164 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); |
159 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); |
| 165 |
[% IF StaffDetailItemSelection %] |
160 |
itemSelectionBuildActionLinks(tab_id); |
| 166 |
itemSelectionBuildActionLinks(tab_id); |
|
|
| 167 |
[% END %] |
| 168 |
}); |
161 |
}); |
| 169 |
|
162 |
|
| 170 |
$(".hide_filters").on("click",function(e){ |
163 |
$(".hide_filters").on("click",function(e){ |
|
Lines 175-183
Link Here
|
| 175 |
tab.find(".show_filters").show(); |
168 |
tab.find(".show_filters").show(); |
| 176 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
169 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
| 177 |
build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback ); |
170 |
build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback ); |
| 178 |
[% IF StaffDetailItemSelection %] |
171 |
itemSelectionBuildActionLinks(tab_id); |
| 179 |
itemSelectionBuildActionLinks(tab_id); |
|
|
| 180 |
[% END %] |
| 181 |
}); |
172 |
}); |
| 182 |
}); |
173 |
}); |
| 183 |
|
174 |
|
|
Lines 278-292
Link Here
|
| 278 |
[% IF hidden_count %] |
269 |
[% IF hidden_count %] |
| 279 |
default_filters.lost_status = "0"; |
270 |
default_filters.lost_status = "0"; |
| 280 |
[% END %] |
271 |
[% END %] |
| 281 |
[% IF StaffDetailItemSelection %] |
|
|
| 282 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
272 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
| 283 |
items_selection[tab_id] = []; |
273 |
items_selection[tab_id] = []; |
| 284 |
} |
274 |
} |
| 285 |
[% END %] |
|
|
| 286 |
|
275 |
|
| 287 |
let offset = 2; |
276 |
let offset = 2; |
| 288 |
[% UNLESS Koha.Preference('LocalCoverImages') %]offset--;[% END %] |
277 |
[% UNLESS Koha.Preference('LocalCoverImages') %]offset--;[% END %] |
| 289 |
[% UNLESS Koha.Preference('StaffDetailItemSelection') %]offset--;[% END %] |
|
|
| 290 |
let filters_options = { |
278 |
let filters_options = { |
| 291 |
[offset] : () => all_item_types, |
279 |
[offset] : () => all_item_types, |
| 292 |
[offset+1] : () => all_libraries, |
280 |
[offset+1] : () => all_libraries, |
|
Lines 300-306
Link Here
|
| 300 |
autoWidth: false, |
288 |
autoWidth: false, |
| 301 |
bKohaColumnsUseNames: true, |
289 |
bKohaColumnsUseNames: true, |
| 302 |
columns: [ |
290 |
columns: [ |
| 303 |
[% IF (StaffDetailItemSelection) %] |
|
|
| 304 |
{ |
291 |
{ |
| 305 |
data: "me.item_id", |
292 |
data: "me.item_id", |
| 306 |
searchable: false, |
293 |
searchable: false, |
|
Lines 317-323
Link Here
|
| 317 |
} |
304 |
} |
| 318 |
} |
305 |
} |
| 319 |
}, |
306 |
}, |
| 320 |
[% END %] |
|
|
| 321 |
[% IF Koha.Preference('LocalCoverImages') %] |
307 |
[% IF Koha.Preference('LocalCoverImages') %] |
| 322 |
{ |
308 |
{ |
| 323 |
data: "", |
309 |
data: "", |
|
Lines 797-807
Link Here
|
| 797 |
table.columns(i).visible(false); |
783 |
table.columns(i).visible(false); |
| 798 |
} |
784 |
} |
| 799 |
}); |
785 |
}); |
| 800 |
[% IF StaffDetailItemSelection %] |
|
|
| 801 |
itemSelectionBuildActionLinks(tab_id); |
786 |
itemSelectionBuildActionLinks(tab_id); |
| 802 |
[% END %] |
|
|
| 803 |
}, |
787 |
}, |
| 804 |
[% IF StaffDetailItemSelection %] |
|
|
| 805 |
drawCallback: function(settings){ |
788 |
drawCallback: function(settings){ |
| 806 |
var api = new $.fn.dataTable.Api(settings) |
789 |
var api = new $.fn.dataTable.Api(settings) |
| 807 |
$.each( |
790 |
$.each( |
|
Lines 841-847
Link Here
|
| 841 |
|
824 |
|
| 842 |
if ( drawcallback ) { drawcallback(this); } |
825 |
if ( drawcallback ) { drawcallback(this); } |
| 843 |
}, |
826 |
}, |
| 844 |
[% END %] |
|
|
| 845 |
...dt_options, |
827 |
...dt_options, |
| 846 |
}, |
828 |
}, |
| 847 |
items_table_settings[tab_id], |
829 |
items_table_settings[tab_id], |