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-73
Link Here
|
51 |
<a href="#" class="show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</a> |
51 |
<a href="#" class="show_filters" data-tab="[% tab | html %]"><i class="fa fa-filter"></i> Show filters</a> |
52 |
<a href="#" class="hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</a> |
52 |
<a href="#" class="hide_filters" data-tab="[% tab | html %]" style="display: none;"><i class="fa fa-filter"></i> Hide filters</a> |
53 |
</span> |
53 |
</span> |
54 |
[% IF (StaffDetailItemSelection) %] |
54 |
<a href="#" class="SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a> |
55 |
| <a href="#" class="SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a> |
55 |
<a href="#" class="ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</a> |
56 |
| <a href="#" class="ClearAll" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</a> |
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 |
<a class="itemselection_action_delete"><i class="fa fa-trash-can"></i> Delete selected items</a> |
60 |
<a class="itemselection_action_delete"><i class="fa fa-trash-can"></i> Delete selected items</a> |
60 |
[% END %] |
61 |
[% END %] |
61 |
[% IF CAN_user_tools_items_batchmod %] |
62 |
[% IF CAN_user_tools_items_batchmod %] |
62 |
<a class="itemselection_action_modify"><i class="fa-solid fa-pencil"></i> Modify selected items</a> |
63 |
<a class="itemselection_action_modify"><i class="fa-solid fa-pencil"></i> Modify selected items</a> |
63 |
[% END %] |
64 |
[% END %] |
64 |
[% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] |
65 |
[% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] |
65 |
<a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a> |
66 |
<a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a> |
66 |
<a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a> |
67 |
<a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a> |
67 |
[% END %] |
68 |
[% END %] |
68 |
</span> |
69 |
</span> |
|
|
70 |
[% END %] |
71 |
</div> |
69 |
</div> |
72 |
|
70 |
|
73 |
[% PROCESS build_table tab => tab %] |
71 |
[% PROCESS build_table tab => tab %] |
Lines 78-150
Link Here
|
78 |
<script> |
76 |
<script> |
79 |
|
77 |
|
80 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
78 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
81 |
[% IF StaffDetailItemSelection %] |
|
|
82 |
|
83 |
let items_selection = {}; |
84 |
function itemSelectionBuildDeleteLink(tab_id) { |
85 |
var itemnumbers = items_selection[tab_id]; |
86 |
if (itemnumbers.length > 0) { |
87 |
var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1'; |
88 |
url += '&itemnumber=' + itemnumbers.join('&itemnumber='); |
89 |
url += '&biblionumber=[% biblionumber | uri %]'; |
90 |
url += '&src=CATALOGUING'; |
91 |
$('a.itemselection_action_delete').attr('href', url); |
92 |
} else { |
93 |
return false; |
94 |
} |
95 |
return true |
96 |
} |
97 |
|
79 |
|
98 |
function itemSelectionBuildModifyLink(tab_id) { |
80 |
let items_selection = {}; |
99 |
var itemnumbers = items_selection[tab_id]; |
81 |
function itemSelectionBuildDeleteLink(tab_id) { |
100 |
if (itemnumbers.length > 0) { |
82 |
var itemnumbers = items_selection[tab_id]; |
101 |
var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; |
83 |
if (itemnumbers.length > 0) { |
102 |
url += '&itemnumber=' + itemnumbers.join('&itemnumber='); |
84 |
var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1'; |
103 |
url += '&biblionumber=[% biblionumber | uri %]'; |
85 |
url += '&itemnumber=' + itemnumbers.join('&itemnumber='); |
104 |
url += '&src=CATALOGUING'; |
86 |
url += '&biblionumber=[% biblionumber | uri %]'; |
105 |
$('a.itemselection_action_modify').attr('href', url); |
87 |
url += '&src=CATALOGUING'; |
106 |
} else { |
88 |
$('a.itemselection_action_delete').attr('href', url); |
107 |
return false; |
89 |
} else { |
108 |
} |
90 |
return false; |
109 |
return true; |
|
|
110 |
} |
91 |
} |
|
|
92 |
return true |
93 |
} |
111 |
|
94 |
|
112 |
function itemSelectionBuildActionLinks(tab_id) { |
95 |
function itemSelectionBuildModifyLink(tab_id) { |
113 |
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); |
96 |
var itemnumbers = items_selection[tab_id]; |
114 |
var modify_link_ok = itemSelectionBuildModifyLink(tab_id); |
97 |
if (itemnumbers.length > 0) { |
115 |
var tab = $("#" + tab_id); |
98 |
var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; |
116 |
if (modify_link_ok || delete_link_ok) { |
99 |
url += '&itemnumber=' + itemnumbers.join('&itemnumber='); |
117 |
$('.itemselection_actions', tab).show(); |
100 |
url += '&biblionumber=[% biblionumber | uri %]'; |
118 |
} else { |
101 |
url += '&src=CATALOGUING'; |
119 |
$('.itemselection_actions', tab).hide(); |
102 |
$('a.itemselection_action_modify').attr('href', url); |
120 |
} |
103 |
} else { |
|
|
104 |
return false; |
121 |
} |
105 |
} |
|
|
106 |
return true; |
107 |
} |
122 |
|
108 |
|
123 |
$(document).ready(function() { |
109 |
function itemSelectionBuildActionLinks(tab_id) { |
|
|
110 |
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); |
111 |
var modify_link_ok = itemSelectionBuildModifyLink(tab_id); |
112 |
var tab = $("#" + tab_id); |
113 |
if (modify_link_ok || delete_link_ok) { |
114 |
$('.itemselection_actions', tab).show(); |
115 |
} else { |
116 |
$('.itemselection_actions', tab).hide(); |
117 |
} |
118 |
} |
124 |
|
119 |
|
125 |
$(".SelectAll").on("click",function(e){ |
120 |
$(document).ready(function() { |
126 |
e.preventDefault(); |
|
|
127 |
let tab_id = $(this).data("tab"); |
128 |
let tab = $("#"+tab_id); |
129 |
tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => { |
130 |
let itemnumber = parseInt($(input).val()); |
131 |
items_selection[tab_id].push(itemnumber); |
132 |
$(input).prop('checked', true); |
133 |
}); |
134 |
itemSelectionBuildActionLinks(tab_id); |
135 |
}); |
136 |
|
121 |
|
137 |
$(".ClearAll").on("click",function(e){ |
122 |
$(".SelectAll").on("click",function(e){ |
138 |
e.preventDefault(); |
123 |
e.preventDefault(); |
139 |
let tab_id = $(this).data("tab"); |
124 |
let tab_id = $(this).data("tab"); |
140 |
let tab = $("#"+tab_id); |
125 |
let tab = $("#"+tab_id); |
141 |
items_selection[tab_id] = []; |
126 |
tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => { |
142 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
127 |
let itemnumber = parseInt($(input).val()); |
143 |
itemSelectionBuildActionLinks(tab_id); |
128 |
items_selection[tab_id].push(itemnumber); |
|
|
129 |
$(input).prop('checked', true); |
144 |
}); |
130 |
}); |
|
|
131 |
itemSelectionBuildActionLinks(tab_id); |
132 |
}); |
145 |
|
133 |
|
|
|
134 |
$(".ClearAll").on("click",function(e){ |
135 |
e.preventDefault(); |
136 |
let tab_id = $(this).data("tab"); |
137 |
let tab = $("#"+tab_id); |
138 |
items_selection[tab_id] = []; |
139 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
140 |
itemSelectionBuildActionLinks(tab_id); |
146 |
}); |
141 |
}); |
147 |
[% END %] |
142 |
|
|
|
143 |
}); |
148 |
|
144 |
|
149 |
|
145 |
|
150 |
$(document).ready(function() { |
146 |
$(document).ready(function() { |
Lines 156-164
Link Here
|
156 |
tab.find(".hide_filters").show(); |
152 |
tab.find(".hide_filters").show(); |
157 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
153 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
158 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); |
154 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); |
159 |
[% IF StaffDetailItemSelection %] |
155 |
itemSelectionBuildActionLinks(tab_id); |
160 |
itemSelectionBuildActionLinks(tab_id); |
|
|
161 |
[% END %] |
162 |
}); |
156 |
}); |
163 |
|
157 |
|
164 |
$(".hide_filters").on("click",function(e){ |
158 |
$(".hide_filters").on("click",function(e){ |
Lines 169-177
Link Here
|
169 |
tab.find(".show_filters").show(); |
163 |
tab.find(".show_filters").show(); |
170 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
164 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
171 |
build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback ); |
165 |
build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback ); |
172 |
[% IF StaffDetailItemSelection %] |
166 |
itemSelectionBuildActionLinks(tab_id); |
173 |
itemSelectionBuildActionLinks(tab_id); |
|
|
174 |
[% END %] |
175 |
}); |
167 |
}); |
176 |
}); |
168 |
}); |
177 |
|
169 |
|
Lines 272-286
Link Here
|
272 |
[% IF hidden_count %] |
264 |
[% IF hidden_count %] |
273 |
default_filters.lost_status = "0"; |
265 |
default_filters.lost_status = "0"; |
274 |
[% END %] |
266 |
[% END %] |
275 |
[% IF StaffDetailItemSelection %] |
|
|
276 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
267 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
277 |
items_selection[tab_id] = []; |
268 |
items_selection[tab_id] = []; |
278 |
} |
269 |
} |
279 |
[% END %] |
|
|
280 |
|
270 |
|
281 |
let offset = 2; |
271 |
let offset = 2; |
282 |
[% UNLESS Koha.Preference('LocalCoverImages') %]offset--;[% END %] |
272 |
[% UNLESS Koha.Preference('LocalCoverImages') %]offset--;[% END %] |
283 |
[% UNLESS Koha.Preference('StaffDetailItemSelection') %]offset--;[% END %] |
|
|
284 |
let filters_options = { |
273 |
let filters_options = { |
285 |
[offset] : () => all_item_types, |
274 |
[offset] : () => all_item_types, |
286 |
[offset+1] : () => all_libraries, |
275 |
[offset+1] : () => all_libraries, |
Lines 294-300
Link Here
|
294 |
autoWidth: false, |
283 |
autoWidth: false, |
295 |
bKohaColumnsUseNames: true, |
284 |
bKohaColumnsUseNames: true, |
296 |
columns: [ |
285 |
columns: [ |
297 |
[% IF (StaffDetailItemSelection) %] |
|
|
298 |
{ |
286 |
{ |
299 |
data: "me.item_id", |
287 |
data: "me.item_id", |
300 |
searchable: false, |
288 |
searchable: false, |
Lines 311-317
Link Here
|
311 |
} |
299 |
} |
312 |
} |
300 |
} |
313 |
}, |
301 |
}, |
314 |
[% END %] |
|
|
315 |
[% IF Koha.Preference('LocalCoverImages') %] |
302 |
[% IF Koha.Preference('LocalCoverImages') %] |
316 |
{ |
303 |
{ |
317 |
data: "", |
304 |
data: "", |
Lines 791-801
Link Here
|
791 |
table.columns(i).visible(false); |
778 |
table.columns(i).visible(false); |
792 |
} |
779 |
} |
793 |
}); |
780 |
}); |
794 |
[% IF StaffDetailItemSelection %] |
|
|
795 |
itemSelectionBuildActionLinks(tab_id); |
781 |
itemSelectionBuildActionLinks(tab_id); |
796 |
[% END %] |
|
|
797 |
}, |
782 |
}, |
798 |
[% IF StaffDetailItemSelection %] |
|
|
799 |
drawCallback: function(settings){ |
783 |
drawCallback: function(settings){ |
800 |
var api = new $.fn.dataTable.Api(settings) |
784 |
var api = new $.fn.dataTable.Api(settings) |
801 |
$.each( |
785 |
$.each( |
Lines 835-841
Link Here
|
835 |
|
819 |
|
836 |
if ( drawcallback ) { drawcallback(this); } |
820 |
if ( drawcallback ) { drawcallback(this); } |
837 |
}, |
821 |
}, |
838 |
[% END %] |
|
|
839 |
...dt_options, |
822 |
...dt_options, |
840 |
}, |
823 |
}, |
841 |
items_table_settings[tab_id], |
824 |
items_table_settings[tab_id], |