|
Lines 162-218
Link Here
|
| 162 |
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", |
162 |
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", |
| 163 |
otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", |
163 |
otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", |
| 164 |
}; |
164 |
}; |
| 165 |
|
|
|
| 166 |
</script> |
165 |
</script> |
| 167 |
|
|
|
| 168 |
<script> |
166 |
<script> |
| 169 |
let items_selection = {}; |
167 |
let items_selection = {}; |
| 170 |
|
168 |
|
| 171 |
function _itemSelectionBuildLink(tab_id, link_class) { |
169 |
function _itemSelectionBuildLink(tab_id, link_class) { |
| 172 |
|
|
|
| 173 |
let itemnumbers = items_selection[tab_id]; |
170 |
let itemnumbers = items_selection[tab_id]; |
| 174 |
let tab = $("#" + tab_id + "_panel" ); |
171 |
let tab = $("#" + tab_id + "_panel"); |
| 175 |
let form = tab.find(link_class); |
172 |
let form = tab.find(link_class); |
| 176 |
$(form).find("input[name='itemnumber']").remove(); |
173 |
$(form).find("input[name='itemnumber']").remove(); |
| 177 |
|
174 |
|
| 178 |
$(itemnumbers).each(function() { |
175 |
$(itemnumbers).each(function () { |
| 179 |
$(form).append("<input name='itemnumber' type='hidden' value='%s'/>".format(this)); |
176 |
$(form).append("<input name='itemnumber' type='hidden' value='%s'/>".format(this)); |
| 180 |
}); |
177 |
}); |
| 181 |
return !!itemnumbers.length |
178 |
return !!itemnumbers.length; |
| 182 |
} |
179 |
} |
| 183 |
function itemSelectionBuildDeleteLink(tab_id) { |
180 |
function itemSelectionBuildDeleteLink(tab_id) { |
| 184 |
return _itemSelectionBuildLink(tab_id, '.itemselection_action_delete_form'); |
181 |
return _itemSelectionBuildLink(tab_id, ".itemselection_action_delete_form"); |
| 185 |
} |
182 |
} |
| 186 |
function itemSelectionBuildModifyLink(tab_id) { |
183 |
function itemSelectionBuildModifyLink(tab_id) { |
| 187 |
return _itemSelectionBuildLink(tab_id, '.itemselection_action_modify_form'); |
184 |
return _itemSelectionBuildLink(tab_id, ".itemselection_action_modify_form"); |
| 188 |
} |
185 |
} |
| 189 |
|
186 |
|
| 190 |
function itemSelectionBuildActionLinks(tab_id) { |
187 |
function itemSelectionBuildActionLinks(tab_id) { |
| 191 |
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); |
188 |
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); |
| 192 |
var modify_link_ok = itemSelectionBuildModifyLink(tab_id); |
189 |
var modify_link_ok = itemSelectionBuildModifyLink(tab_id); |
| 193 |
var tab = $("#" + tab_id + "_panel" ); |
190 |
var tab = $("#" + tab_id + "_panel"); |
| 194 |
if (modify_link_ok || delete_link_ok) { |
191 |
if (modify_link_ok || delete_link_ok) { |
| 195 |
$('.itemselection_actions', tab).show(); |
192 |
$(".itemselection_actions", tab).show(); |
| 196 |
} else { |
193 |
} else { |
| 197 |
$('.itemselection_actions', tab).hide(); |
194 |
$(".itemselection_actions", tab).hide(); |
| 198 |
} |
195 |
} |
| 199 |
} |
196 |
} |
| 200 |
|
197 |
|
| 201 |
function update_columns_visibility(table_dt, table_settings, user_colvis){ |
198 |
function update_columns_visibility(table_dt, table_settings, user_colvis) { |
| 202 |
table_dt.columns().visible(true, false); |
199 |
table_dt.columns().visible(true, false); |
| 203 |
let hidden_ids = _dt_visibility(table_settings, table_dt); |
200 |
let hidden_ids = _dt_visibility(table_settings, table_dt); |
| 204 |
table_dt.columns(hidden_ids).visible(false, false); |
201 |
table_dt.columns(hidden_ids).visible(false, false); |
| 205 |
table_dt.columns().every(function(){ |
202 |
table_dt.columns().every(function () { |
| 206 |
let i = this.index(); |
203 |
let i = this.index(); |
| 207 |
let is_empty = true; |
204 |
let is_empty = true; |
| 208 |
let nodes = this.nodes(); |
205 |
let nodes = this.nodes(); |
| 209 |
nodes.each((td, ii) => { |
206 |
nodes.each((td, ii) => { |
| 210 |
if ( $(td).html() !== '' ) { |
207 |
if ($(td).html() !== "") { |
| 211 |
is_empty = false; |
208 |
is_empty = false; |
| 212 |
return; |
209 |
return; |
| 213 |
} |
210 |
} |
| 214 |
}); |
211 |
}); |
| 215 |
if ( is_empty ) { |
212 |
if (is_empty) { |
| 216 |
table_dt.columns(i).visible(false, false); |
213 |
table_dt.columns(i).visible(false, false); |
| 217 |
} |
214 |
} |
| 218 |
}); |
215 |
}); |
|
Lines 221-286
Link Here
|
| 221 |
} |
218 |
} |
| 222 |
} |
219 |
} |
| 223 |
|
220 |
|
| 224 |
|
221 |
$(document).ready(function () { |
| 225 |
$(document).ready(function() { |
222 |
$(".SelectAll").on("click", function (e) { |
| 226 |
|
|
|
| 227 |
$(".SelectAll").on("click",function(e){ |
| 228 |
e.preventDefault(); |
223 |
e.preventDefault(); |
| 229 |
let tab_id = $(this).data("tab"); |
224 |
let tab_id = $(this).data("tab"); |
| 230 |
let tab = $("#" + tab_id + "_panel" ); |
225 |
let tab = $("#" + tab_id + "_panel"); |
| 231 |
items_selection[tab_id] = []; |
226 |
items_selection[tab_id] = []; |
| 232 |
tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => { |
227 |
tab.find("input[name='itemnumber'][type='checkbox']").each((i, input) => { |
| 233 |
let itemnumber = parseInt($(input).val()); |
228 |
let itemnumber = parseInt($(input).val()); |
| 234 |
items_selection[tab_id].push(itemnumber); |
229 |
items_selection[tab_id].push(itemnumber); |
| 235 |
$(input).prop('checked', true); |
230 |
$(input).prop("checked", true); |
| 236 |
}); |
231 |
}); |
| 237 |
itemSelectionBuildActionLinks(tab_id); |
232 |
itemSelectionBuildActionLinks(tab_id); |
| 238 |
}); |
233 |
}); |
| 239 |
|
234 |
|
| 240 |
$(".ClearAll").on("click",function(e){ |
235 |
$(".ClearAll").on("click", function (e) { |
| 241 |
e.preventDefault(); |
236 |
e.preventDefault(); |
| 242 |
let tab_id = $(this).data("tab"); |
237 |
let tab_id = $(this).data("tab"); |
| 243 |
let tab = $("#" + tab_id + "_panel" ); |
238 |
let tab = $("#" + tab_id + "_panel"); |
| 244 |
items_selection[tab_id] = []; |
239 |
items_selection[tab_id] = []; |
| 245 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
240 |
$("input[name='itemnumber'][type='checkbox']", tab).prop("checked", false); |
| 246 |
itemSelectionBuildActionLinks(tab_id); |
241 |
itemSelectionBuildActionLinks(tab_id); |
| 247 |
}); |
242 |
}); |
| 248 |
|
|
|
| 249 |
}); |
243 |
}); |
| 250 |
|
244 |
|
| 251 |
let filters_shown = false; |
245 |
let filters_shown = false; |
| 252 |
$(document).ready(function() { |
246 |
$(document).ready(function () { |
| 253 |
$(".show_filters").on("click",function(e){ |
247 |
$(".show_filters").on("click", function (e) { |
| 254 |
e.preventDefault(); |
248 |
e.preventDefault(); |
| 255 |
let tab_id = $(this).data("tab"); |
249 |
let tab_id = $(this).data("tab"); |
| 256 |
let tab = $("#" + tab_id + "_panel" ); |
250 |
let tab = $("#" + tab_id + "_panel"); |
| 257 |
tab.find(".show_filters").hide(); |
251 |
tab.find(".show_filters").hide(); |
| 258 |
tab.find(".hide_filters").show(); |
252 |
tab.find(".hide_filters").show(); |
| 259 |
filters_show = true; |
253 |
filters_show = true; |
| 260 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
254 |
$("#" + tab_id + "_table thead tr:eq(1)").remove(); |
| 261 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); |
255 |
build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback); |
| 262 |
itemSelectionBuildActionLinks(tab_id); |
256 |
itemSelectionBuildActionLinks(tab_id); |
| 263 |
}); |
257 |
}); |
| 264 |
|
258 |
|
| 265 |
$(".hide_filters").on("click",function(e){ |
259 |
$(".hide_filters").on("click", function (e) { |
| 266 |
e.preventDefault(); |
260 |
e.preventDefault(); |
| 267 |
let tab_id = $(this).data("tab"); |
261 |
let tab_id = $(this).data("tab"); |
| 268 |
let tab = $("#" + tab_id + "_panel" ); |
262 |
let tab = $("#" + tab_id + "_panel"); |
| 269 |
tab.find(".hide_filters").hide(); |
263 |
tab.find(".hide_filters").hide(); |
| 270 |
tab.find(".show_filters").show(); |
264 |
tab.find(".show_filters").show(); |
| 271 |
filters_show = false; |
265 |
filters_show = false; |
| 272 |
$("#"+tab_id+"_table thead tr:eq(1)").remove(); |
266 |
$("#" + tab_id + "_table thead tr:eq(1)").remove(); |
| 273 |
build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback ); |
267 |
build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback); |
| 274 |
itemSelectionBuildActionLinks(tab_id); |
268 |
itemSelectionBuildActionLinks(tab_id); |
| 275 |
}); |
269 |
}); |
| 276 |
}); |
270 |
}); |
| 277 |
|
271 |
|
| 278 |
const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted"), in_bundle: _("In bundle")}; |
272 |
const statuses = { |
| 279 |
const all_statuses = Object.keys(statuses).map(k => {return {_id: k, _str: statuses[k]}}); |
273 |
checked_out: _("Checked out"), |
|
|
274 |
local_use: _("On-site checkout"), |
| 275 |
in_transit: _("In transit"), |
| 276 |
lost: _("Lost"), |
| 277 |
withdrawn: _("Withdrawn"), |
| 278 |
damaged: _("Damaged"), |
| 279 |
not_for_loan: _("Not for loan"), |
| 280 |
on_hold: _("On hold"), |
| 281 |
recalled: _("Recalled"), |
| 282 |
available: _("Available"), |
| 283 |
restricted: _("Restricted"), |
| 284 |
in_bundle: _("In bundle"), |
| 285 |
}; |
| 286 |
const all_statuses = Object.keys(statuses).map(k => { |
| 287 |
return { _id: k, _str: statuses[k] }; |
| 288 |
}); |
| 280 |
|
289 |
|
| 281 |
var coded_values = { |
290 |
var coded_values = { |
| 282 |
library: new Map(all_libraries.map( l => [l.branchname, l.branchcode] )), |
291 |
library: new Map(all_libraries.map(l => [l.branchname, l.branchcode])), |
| 283 |
item_type: new Map(all_item_types.map( i => [i.translated_description, i.itemtype] )), |
292 |
item_type: new Map(all_item_types.map(i => [i.translated_description, i.itemtype])), |
| 284 |
collection_code: av_ccode, |
293 |
collection_code: av_ccode, |
| 285 |
location: av_loc, |
294 |
location: av_loc, |
| 286 |
}; |
295 |
}; |
|
Lines 297-429
Link Here
|
| 297 |
// Do we need separate/new endpoints or do we hack the somewhere client-side? |
306 |
// Do we need separate/new endpoints or do we hack the somewhere client-side? |
| 298 |
let item_table_url = `/api/v1/biblios/${biblionumber}/items?`; |
307 |
let item_table_url = `/api/v1/biblios/${biblionumber}/items?`; |
| 299 |
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"]; |
308 |
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"]; |
| 300 |
if (prefs.LocalCoverImages){ |
309 |
if (prefs.LocalCoverImages) { |
| 301 |
embed.push('cover_image_ids'); |
310 |
embed.push("cover_image_ids"); |
| 302 |
} |
311 |
} |
| 303 |
if (prefs.EnableItemGroups){ |
312 |
if (prefs.EnableItemGroups) { |
| 304 |
embed.push('item_group_item.item_group.description'); |
313 |
embed.push("item_group_item.item_group.description"); |
| 305 |
} |
314 |
} |
| 306 |
if (is_serial){ |
315 |
if (is_serial) { |
| 307 |
embed.push('serial_item.serial'); |
316 |
embed.push("serial_item.serial"); |
| 308 |
} |
317 |
} |
| 309 |
if (prefs.UseRecalls){ |
318 |
if (prefs.UseRecalls) { |
| 310 |
embed.push('recall', 'recall+strings', 'recall.patron') |
319 |
embed.push("recall", "recall+strings", "recall.patron"); |
| 311 |
} |
320 |
} |
| 312 |
embed.push('in_bundle', 'bundle_host', 'bundle_host.biblio', 'bundle_items_lost+count', 'bundle_items_not_lost+count'); |
321 |
embed.push("in_bundle", "bundle_host", "bundle_host.biblio", "bundle_items_lost+count", "bundle_items_not_lost+count"); |
| 313 |
if (prefs.UseCourseReserves){ |
322 |
if (prefs.UseCourseReserves) { |
| 314 |
embed.push('course_item.course_reserves.course'); |
323 |
embed.push("course_item.course_reserves.course"); |
| 315 |
} |
324 |
} |
| 316 |
if (prefs.ClaimReturnedLostValue){ |
325 |
if (prefs.ClaimReturnedLostValue) { |
| 317 |
embed.push('return_claims'); |
326 |
embed.push("return_claims"); |
| 318 |
} |
327 |
} |
| 319 |
|
328 |
|
| 320 |
if (prefs.EasyAnalyticalRecords){ |
329 |
if (prefs.EasyAnalyticalRecords) { |
| 321 |
// For host records |
330 |
// For host records |
| 322 |
embed.push('biblio.title'); |
331 |
embed.push("biblio.title"); |
| 323 |
} |
332 |
} |
| 324 |
|
333 |
|
| 325 |
if (analyze){ |
334 |
if (analyze) { |
| 326 |
embed.push('analytics_count'); |
335 |
embed.push("analytics_count"); |
| 327 |
} |
336 |
} |
| 328 |
|
337 |
|
| 329 |
let user_colvis = {holdings: {}, otherholdings: {}}; |
338 |
let user_colvis = { holdings: {}, otherholdings: {} }; |
| 330 |
function build_items_table (tab_id, add_filters, dt_options, drawcallback) { |
339 |
function build_items_table(tab_id, add_filters, dt_options, drawcallback) { |
| 331 |
|
|
|
| 332 |
let table_dt; |
340 |
let table_dt; |
| 333 |
if ( dt_options && dt_options.hasOwnProperty('destroy') ) { |
341 |
if (dt_options && dt_options.hasOwnProperty("destroy")) { |
| 334 |
// Keep a copy of the user settings, the destroy is going to trigger the column-visibility.dt event for all columns |
342 |
// Keep a copy of the user settings, the destroy is going to trigger the column-visibility.dt event for all columns |
| 335 |
let user_colvis_bak= Object.assign({}, user_colvis[tab_id]); |
343 |
let user_colvis_bak = Object.assign({}, user_colvis[tab_id]); |
| 336 |
let table_id = "#"+tab_id+"_table"; |
344 |
let table_id = "#" + tab_id + "_table"; |
| 337 |
if( $.fn.dataTable.isDataTable(table_id) ) { |
345 |
if ($.fn.dataTable.isDataTable(table_id)) { |
| 338 |
$(table_id).DataTable().destroy(); |
346 |
$(table_id).DataTable().destroy(); |
| 339 |
} |
347 |
} |
| 340 |
$(table_id).replaceWith(table_nodes[tab_id]); |
348 |
$(table_id).replaceWith(table_nodes[tab_id]); |
| 341 |
dt_options['destroy'] = null; |
349 |
dt_options["destroy"] = null; |
| 342 |
user_colvis[tab_id] = user_colvis_bak; |
350 |
user_colvis[tab_id] = user_colvis_bak; |
| 343 |
} |
351 |
} |
| 344 |
let default_filters = {}; |
352 |
let default_filters = {}; |
| 345 |
if (prefs.SeparateHoldings){ |
353 |
if (prefs.SeparateHoldings) { |
| 346 |
let branch = prefs.SeparateHoldingsBranch == 'homebranch' ? 'me.home_library_id' : 'me.holding_library_id'; |
354 |
let branch = prefs.SeparateHoldingsBranch == "homebranch" ? "me.home_library_id" : "me.holding_library_id"; |
| 347 |
if ( tab_id == 'holdings' ) { |
355 |
if (tab_id == "holdings") { |
| 348 |
default_filters[branch] = logged_in_branchcode; |
356 |
default_filters[branch] = logged_in_branchcode; |
| 349 |
} else { |
357 |
} else { |
| 350 |
default_filters[branch] = { '!=': logged_in_branchcode }; |
358 |
default_filters[branch] = { "!=": logged_in_branchcode }; |
| 351 |
} |
359 |
} |
| 352 |
} |
360 |
} |
| 353 |
|
361 |
|
| 354 |
if (hidden_count){ |
362 |
if (hidden_count) { |
| 355 |
default_filters.lost_status = "0"; |
363 |
default_filters.lost_status = "0"; |
| 356 |
} |
364 |
} |
| 357 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
365 |
if (!items_selection.hasOwnProperty(tab_id)) { |
| 358 |
items_selection[tab_id] = []; |
366 |
items_selection[tab_id] = []; |
| 359 |
} |
367 |
} |
| 360 |
|
368 |
|
| 361 |
default_filters._status = function(){ |
369 |
default_filters._status = function () { |
| 362 |
return $("#" + tab_id + "_status select").val(); |
370 |
return $("#" + tab_id + "_status select").val(); |
| 363 |
}; |
371 |
}; |
| 364 |
|
372 |
|
| 365 |
var columns = [ |
373 |
var columns = [ |
| 366 |
{ |
374 |
{ |
| 367 |
data: "me.item_id", |
375 |
data: "me.item_id", |
| 368 |
searchable: false, |
376 |
searchable: false, |
| 369 |
orderable: false, |
377 |
orderable: false, |
| 370 |
render: function (data, type, row, meta) { |
378 |
render: function (data, type, row, meta) { |
| 371 |
if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){ |
379 |
if (can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length) { |
| 372 |
if ( items_selection[tab_id].includes(row.item_id) ) { |
380 |
if (items_selection[tab_id].includes(row.item_id)) { |
| 373 |
return '<input type="checkbox" value="%s" name="itemnumber" checked />'.format(row.item_id); |
381 |
return '<input type="checkbox" value="%s" name="itemnumber" checked />'.format(row.item_id); |
| 374 |
} else { |
382 |
} else { |
| 375 |
return '<input type="checkbox" value="%s" name="itemnumber" />'.format(row.item_id); |
383 |
return '<input type="checkbox" value="%s" name="itemnumber" />'.format(row.item_id); |
| 376 |
} |
384 |
} |
| 377 |
} else { |
385 |
} else { |
| 378 |
return '' |
386 |
return ""; |
| 379 |
} |
387 |
} |
| 380 |
} |
388 |
}, |
| 381 |
}, |
389 |
}, |
| 382 |
...(prefs.LocalCoverImages ? |
390 |
...(prefs.LocalCoverImages |
| 383 |
[{ |
391 |
? [ |
| 384 |
data: "", |
392 |
{ |
| 385 |
className: "cover", |
393 |
data: "", |
| 386 |
searchable: false, |
394 |
className: "cover", |
| 387 |
orderable: false, |
395 |
searchable: false, |
| 388 |
render: function (data, type, row, meta) { |
396 |
orderable: false, |
| 389 |
if ( !row.cover_image_ids.length > 0 ) { |
397 |
render: function (data, type, row, meta) { |
| 390 |
return ''; |
398 |
if (!row.cover_image_ids.length > 0) { |
| 391 |
} |
399 |
return ""; |
| 392 |
let node = '<div class="bookcoverimg">'; |
400 |
} |
| 393 |
node += '<div class="cover-slider">'; |
401 |
let node = '<div class="bookcoverimg">'; |
| 394 |
row.cover_image_ids.forEach(id => { |
402 |
node += '<div class="cover-slider">'; |
| 395 |
node += '<div class="cover-image local-coverimg">'; |
403 |
row.cover_image_ids.forEach(id => { |
| 396 |
node += '<a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=%s" title="%s">'.format(id, _("Local cover image")); |
404 |
node += '<div class="cover-image local-coverimg">'; |
| 397 |
node += '<img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=%s" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=%s&imagenumber=%s" alt="%s" />'.format(id, row.item_id, id, _("Local cover image")); |
405 |
node += '<a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=%s" title="%s">'.format(id, _("Local cover image")); |
| 398 |
node += '</a>'; |
406 |
node += '<img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=%s" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=%s&imagenumber=%s" alt="%s" />'.format( |
| 399 |
node += '</div>'; |
407 |
id, |
| 400 |
}); |
408 |
row.item_id, |
| 401 |
node += '</div>'; |
409 |
id, |
| 402 |
node += '</div>'; |
410 |
_("Local cover image") |
| 403 |
return node; |
411 |
); |
| 404 |
} |
412 |
node += "</a>"; |
| 405 |
}] : []), |
413 |
node += "</div>"; |
| 406 |
...(prefs.item_level_itypes ? |
414 |
}); |
| 407 |
[{ |
415 |
node += "</div>"; |
| 408 |
data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
416 |
node += "</div>"; |
| 409 |
datatype: "coded_value:item_type", |
417 |
return node; |
| 410 |
dataFilter: "item_types", |
418 |
}, |
| 411 |
className: "itype", |
419 |
}, |
| 412 |
searchable: true, |
420 |
] |
| 413 |
orderable: true, |
421 |
: []), |
| 414 |
render: function (data, type, row, meta) { |
422 |
...(prefs.item_level_itypes |
| 415 |
let node = ''; |
423 |
? [ |
| 416 |
let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; |
424 |
{ |
| 417 |
if (prefs.noItemTypeImages){ |
425 |
data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
| 418 |
let image_location = item_type_image_locations[row.item_type_id]; |
426 |
datatype: "coded_value:item_type", |
| 419 |
node += image_location |
427 |
dataFilter: "item_types", |
| 420 |
? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description)) |
428 |
className: "itype", |
| 421 |
: ''; |
429 |
searchable: true, |
| 422 |
} |
430 |
orderable: true, |
| 423 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description)); |
431 |
render: function (data, type, row, meta) { |
| 424 |
return node; |
432 |
let node = ""; |
| 425 |
} |
433 |
let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; |
| 426 |
}] : []), |
434 |
if (prefs.noItemTypeImages) { |
|
|
435 |
let image_location = item_type_image_locations[row.item_type_id]; |
| 436 |
node += image_location ? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description)) : ""; |
| 437 |
} |
| 438 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description)); |
| 439 |
return node; |
| 440 |
}, |
| 441 |
}, |
| 442 |
] |
| 443 |
: []), |
| 427 |
{ |
444 |
{ |
| 428 |
data: "me.holding_library_id", |
445 |
data: "me.holding_library_id", |
| 429 |
datatype: "coded_value:library", |
446 |
datatype: "coded_value:library", |
|
Lines 433-439
var columns = [
Link Here
|
| 433 |
orderable: true, |
450 |
orderable: true, |
| 434 |
render: function (data, type, row, meta) { |
451 |
render: function (data, type, row, meta) { |
| 435 |
return escape_str(row._strings.holding_library_id ? row._strings.holding_library_id.str : row.holding_library_id); |
452 |
return escape_str(row._strings.holding_library_id ? row._strings.holding_library_id.str : row.holding_library_id); |
| 436 |
} |
453 |
}, |
| 437 |
}, |
454 |
}, |
| 438 |
{ |
455 |
{ |
| 439 |
data: "me.home_library_id", |
456 |
data: "me.home_library_id", |
|
Lines 444-450
var columns = [
Link Here
|
| 444 |
orderable: true, |
461 |
orderable: true, |
| 445 |
render: function (data, type, row, meta) { |
462 |
render: function (data, type, row, meta) { |
| 446 |
return escape_str(row._strings.home_library_id ? row._strings.home_library_id.str : row.home_library_id); |
463 |
return escape_str(row._strings.home_library_id ? row._strings.home_library_id.str : row.home_library_id); |
| 447 |
} |
464 |
}, |
| 448 |
}, |
465 |
}, |
| 449 |
{ |
466 |
{ |
| 450 |
data: "me.location", |
467 |
data: "me.location", |
|
Lines 457-471
var columns = [
Link Here
|
| 457 |
// display current location in parentheses. If not, display current location. |
474 |
// display current location in parentheses. If not, display current location. |
| 458 |
// Note that permanent location is a code, and location may be an authval. |
475 |
// Note that permanent location is a code, and location may be an authval. |
| 459 |
let loc_str = row._strings.location ? row._strings.location.str : row.location; |
476 |
let loc_str = row._strings.location ? row._strings.location.str : row.location; |
| 460 |
if ( row.permanent_location && row.permanent_location != row.location ) { |
477 |
if (row.permanent_location && row.permanent_location != row.location) { |
| 461 |
let permanent_loc_str = av_loc.get(row.permanent_location); |
478 |
let permanent_loc_str = av_loc.get(row.permanent_location); |
| 462 |
nodes += '%s (%s)'.format(escape_str(permanent_loc_str), escape_str(loc_str)); |
479 |
nodes += "%s (%s)".format(escape_str(permanent_loc_str), escape_str(loc_str)); |
| 463 |
} else { |
480 |
} else { |
| 464 |
nodes += escape_str(loc_str); |
481 |
nodes += escape_str(loc_str); |
| 465 |
} |
482 |
} |
| 466 |
nodes += '</span>'; |
483 |
nodes += "</span>"; |
| 467 |
return nodes; |
484 |
return nodes; |
| 468 |
} |
485 |
}, |
| 469 |
}, |
486 |
}, |
| 470 |
{ |
487 |
{ |
| 471 |
data: "me.collection_code", |
488 |
data: "me.collection_code", |
|
Lines 474-495
var columns = [
Link Here
|
| 474 |
orderable: true, |
491 |
orderable: true, |
| 475 |
render: function (data, type, row, meta) { |
492 |
render: function (data, type, row, meta) { |
| 476 |
return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code); |
493 |
return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code); |
| 477 |
} |
494 |
}, |
| 478 |
}, |
495 |
}, |
| 479 |
...(prefs.EnableItemGroups ? |
496 |
...(prefs.EnableItemGroups |
| 480 |
[{ |
497 |
? [ |
| 481 |
data: "item_group_item.item_group.description", |
498 |
{ |
| 482 |
className: "item_group", |
499 |
data: "item_group_item.item_group.description", |
| 483 |
searchable: true, |
500 |
className: "item_group", |
| 484 |
orderable: true, |
501 |
searchable: true, |
| 485 |
render: function (data, type, row, meta) { |
502 |
orderable: true, |
| 486 |
if ( row.item_group_item ) { |
503 |
render: function (data, type, row, meta) { |
| 487 |
return escape_str(row.item_group_item.item_group.description); |
504 |
if (row.item_group_item) { |
| 488 |
} else { |
505 |
return escape_str(row.item_group_item.item_group.description); |
| 489 |
return ""; |
506 |
} else { |
| 490 |
} |
507 |
return ""; |
| 491 |
} |
508 |
} |
| 492 |
}] : []), |
509 |
}, |
|
|
510 |
}, |
| 511 |
] |
| 512 |
: []), |
| 493 |
{ |
513 |
{ |
| 494 |
data: "me.callnumber", |
514 |
data: "me.callnumber", |
| 495 |
className: "itemcallnumber", |
515 |
className: "itemcallnumber", |
|
Lines 497-504
var columns = [
Link Here
|
| 497 |
orderable: true, |
517 |
orderable: true, |
| 498 |
render: function (data, type, row, meta) { |
518 |
render: function (data, type, row, meta) { |
| 499 |
return escape_str(row.callnumber); |
519 |
return escape_str(row.callnumber); |
| 500 |
} |
520 |
}, |
| 501 |
|
|
|
| 502 |
}, |
521 |
}, |
| 503 |
{ |
522 |
{ |
| 504 |
data: "me.serial_issue_number", |
523 |
data: "me.serial_issue_number", |
|
Lines 509-532
var columns = [
Link Here
|
| 509 |
let nodes = ""; |
528 |
let nodes = ""; |
| 510 |
// FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? |
529 |
// FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? |
| 511 |
let serial = row.serial_item ? row.serial_item.serial : null; |
530 |
let serial = row.serial_item ? row.serial_item.serial : null; |
| 512 |
if ( row.serial_issue_number && serial && serial.serialseq ) { |
531 |
if (row.serial_issue_number && serial && serial.serialseq) { |
| 513 |
nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); |
532 |
nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); |
| 514 |
if ( serial.serialseq && row.serial_issue_number != serial.serialseq ) { |
533 |
if (serial.serialseq && row.serial_issue_number != serial.serialseq) { |
| 515 |
nodes += ' <span class="sep"> -- </span>' |
534 |
nodes += ' <span class="sep"> -- </span>'; |
| 516 |
nodes += ' <span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); |
535 |
nodes += ' <span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); |
| 517 |
} |
536 |
} |
| 518 |
} else if ( row.serial_issue_number ) { |
537 |
} else if (row.serial_issue_number) { |
| 519 |
nodes += ' <span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); |
538 |
nodes += ' <span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); |
| 520 |
} else if ( serial && serial.serialseq ) { |
539 |
} else if (serial && serial.serialseq) { |
| 521 |
nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); |
540 |
nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); |
| 522 |
} |
541 |
} |
| 523 |
if (prefs.DisplayPublishedDate){ |
542 |
if (prefs.DisplayPublishedDate) { |
| 524 |
if ( serial && serial.publisheddate ) { |
543 |
if (serial && serial.publisheddate) { |
| 525 |
nodes += ' <span class="pubdate">(%s)</span>'.format($date(serial.publisheddate)); |
544 |
nodes += ' <span class="pubdate">(%s)</span>'.format($date(serial.publisheddate)); |
| 526 |
} |
545 |
} |
| 527 |
} |
546 |
} |
| 528 |
return nodes; |
547 |
return nodes; |
| 529 |
} |
548 |
}, |
| 530 |
}, |
549 |
}, |
| 531 |
{ |
550 |
{ |
| 532 |
data: "", |
551 |
data: "", |
|
Lines 536-602
var columns = [
Link Here
|
| 536 |
orderable: false, |
555 |
orderable: false, |
| 537 |
render: function (data, type, row, meta) { |
556 |
render: function (data, type, row, meta) { |
| 538 |
let nodes = ""; |
557 |
let nodes = ""; |
| 539 |
row._status.forEach( status => { |
558 |
row._status.forEach(status => { |
| 540 |
if ( status == 'checked_out' || status == 'local_use') { |
559 |
if (status == "checked_out" || status == "local_use") { |
| 541 |
nodes += '<span>'; |
560 |
nodes += "<span>"; |
| 542 |
|
561 |
|
| 543 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
562 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
| 544 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
563 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
| 545 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
564 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
| 546 |
|
565 |
|
| 547 |
if ( status == 'local_use' ) { |
566 |
if (status == "local_use") { |
| 548 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
567 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
| 549 |
} else { |
568 |
} else { |
| 550 |
nodes += '<span class="datedue">'; |
569 |
nodes += '<span class="datedue">'; |
| 551 |
nodes += _("Checked out to %s").format(patron_to_html); |
570 |
nodes += _("Checked out to %s").format(patron_to_html); |
| 552 |
} |
571 |
} |
| 553 |
nodes += ': '; |
572 |
nodes += ": "; |
| 554 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
573 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
| 555 |
nodes += "</span>" |
574 |
nodes += "</span>"; |
| 556 |
|
|
|
| 557 |
} |
575 |
} |
| 558 |
if ( status == 'in_transit' ) { |
576 |
if (status == "in_transit") { |
| 559 |
if ( row.transfer.datesent ) { |
577 |
if (row.transfer.datesent) { |
| 560 |
nodes += '<span class="intransit">%s</span>'.format(_("In transit from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.datesent))); |
578 |
nodes += '<span class="intransit">%s</span>'.format( |
|
|
579 |
_("In transit from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.datesent)) |
| 580 |
); |
| 561 |
} else { |
581 |
} else { |
| 562 |
nodes += '<span class="transitrequested">%s</span>'.format(_("Transit pending from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.daterequested))); |
582 |
nodes += '<span class="transitrequested">%s</span>'.format( |
|
|
583 |
_("Transit pending from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.daterequested)) |
| 584 |
); |
| 563 |
} |
585 |
} |
| 564 |
} |
586 |
} |
| 565 |
|
587 |
|
| 566 |
if ( status == 'lost' ) { |
588 |
if (status == "lost") { |
| 567 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
589 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
| 568 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
590 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
| 569 |
|
591 |
|
| 570 |
const hasReturnClaims = row.return_claims && row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false |
592 |
const hasReturnClaims = row.return_claims && row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false; |
| 571 |
if(hasReturnClaims) { |
593 |
if (hasReturnClaims) { |
| 572 |
nodes += '<span class="holding_status claimed_returned">' + _("(Claimed returned)") + '</span>'; |
594 |
nodes += '<span class="holding_status claimed_returned">' + _("(Claimed returned)") + "</span>"; |
| 573 |
} |
595 |
} |
| 574 |
} |
596 |
} |
| 575 |
|
597 |
|
| 576 |
if ( status == 'withdrawn' ) { |
598 |
if (status == "withdrawn") { |
| 577 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
599 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
| 578 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
600 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
| 579 |
} |
601 |
} |
| 580 |
|
602 |
|
| 581 |
if ( status == 'damaged' ) { |
603 |
if (status == "damaged") { |
| 582 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
604 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
| 583 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
605 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
| 584 |
} |
606 |
} |
| 585 |
|
607 |
|
| 586 |
if ( status == 'not_for_loan' ) { |
608 |
if (status == "not_for_loan") { |
| 587 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
609 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
| 588 |
nodes += '<span class="notforloan">%s'.format(_("Not for loan")) + ( not_for_loan_lib ? '<span class="reason"> (%s)</span>'.format(escape_str(not_for_loan_lib)) : '' ) + '</span>'; |
610 |
nodes += '<span class="notforloan">%s'.format(_("Not for loan")) + (not_for_loan_lib ? '<span class="reason"> (%s)</span>'.format(escape_str(not_for_loan_lib)) : "") + "</span>"; |
| 589 |
} |
611 |
} |
| 590 |
|
612 |
|
| 591 |
if ( status == 'on_hold') { |
613 |
if (status == "on_hold") { |
| 592 |
if ( row.first_hold.waiting_date ) { |
614 |
if (row.first_hold.waiting_date) { |
| 593 |
if ( row.first_hold.desk ) { |
615 |
if (row.first_hold.desk) { |
| 594 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s, %s since %s.".format(row.first_hold._strings.pickup_library_id.str, row.first_hold.desk.desk_name, $date(row.first_hold.waiting_date)))); |
616 |
nodes += '<span class="waitingat">%s</span>'.format( |
|
|
617 |
_("Waiting at %s, %s since %s.".format(row.first_hold._strings.pickup_library_id.str, row.first_hold.desk.desk_name, $date(row.first_hold.waiting_date))) |
| 618 |
); |
| 595 |
} else { |
619 |
} else { |
| 596 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.".format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)))); |
620 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.".format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)))); |
| 597 |
} |
621 |
} |
| 598 |
if (prefs.canreservefromotherbranches){ |
622 |
if (prefs.canreservefromotherbranches) { |
| 599 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
623 |
if (row.first_hold.waiting_date || row.first_hold.priority == 1) { |
| 600 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
624 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
| 601 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
625 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
| 602 |
|
626 |
|
|
Lines 609-640
var columns = [
Link Here
|
| 609 |
} |
633 |
} |
| 610 |
} |
634 |
} |
| 611 |
|
635 |
|
| 612 |
if (prefs.UseRecalls){ |
636 |
if (prefs.UseRecalls) { |
| 613 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
637 |
if (row.recall && row.item_id === row.recall.item_id) { |
| 614 |
if ( row.recall.waiting_date ) { |
638 |
if (row.recall.waiting_date) { |
| 615 |
nodes += '<span class="holding_status recallwaiting">%s</span>'.format(_("Waiting recall at %s since %s").format(escape_str(row.recall._strings.pickup_library_id.str), $date(row.recall.waiting_date))); |
639 |
nodes += '<span class="holding_status recallwaiting">%s</span>'.format( |
| 616 |
} else { |
640 |
_("Waiting recall at %s since %s").format(escape_str(row.recall._strings.pickup_library_id.str), $date(row.recall.waiting_date)) |
| 617 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
641 |
); |
| 618 |
row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) }; |
642 |
} else { |
|
|
643 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
| 644 |
row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) }; |
| 619 |
|
645 |
|
| 620 |
let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name }); |
646 |
let patron_to_html = $patron_to_html(row.recall.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
| 621 |
nodes += '<span class="holding_status recalledby">%s</span>'.format(_("Recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date))) |
647 |
nodes += '<span class="holding_status recalledby">%s</span>'.format(_("Recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date))); |
|
|
648 |
} |
| 622 |
} |
649 |
} |
| 623 |
} |
650 |
} |
| 624 |
} |
651 |
if (status == "available") { |
| 625 |
if ( status == 'available' ) { |
652 |
nodes += " <span>%s</span>".format(_("Available")); |
| 626 |
nodes += ' <span>%s</span>'.format(_("Available")) |
|
|
| 627 |
} |
653 |
} |
| 628 |
|
654 |
|
| 629 |
if ( status == 'restricted') { |
655 |
if (status == "restricted") { |
| 630 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
656 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
| 631 |
} |
657 |
} |
| 632 |
if ( status == 'in_bundle') { |
658 |
if (status == "in_bundle") { |
| 633 |
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
659 |
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
| 634 |
} |
660 |
} |
| 635 |
}); |
661 |
}); |
| 636 |
return nodes; |
662 |
return nodes; |
| 637 |
} |
663 |
}, |
| 638 |
}, |
664 |
}, |
| 639 |
{ |
665 |
{ |
| 640 |
data: "me.last_seen_date", |
666 |
data: "me.last_seen_date", |
|
Lines 644-650
var columns = [
Link Here
|
| 644 |
orderable: true, |
670 |
orderable: true, |
| 645 |
render: function (data, type, row, meta) { |
671 |
render: function (data, type, row, meta) { |
| 646 |
return $datetime(row.last_seen_date); |
672 |
return $datetime(row.last_seen_date); |
| 647 |
} |
673 |
}, |
| 648 |
}, |
674 |
}, |
| 649 |
{ |
675 |
{ |
| 650 |
data: "me.checkouts_count", |
676 |
data: "me.checkouts_count", |
|
Lines 653-659
var columns = [
Link Here
|
| 653 |
orderable: true, |
679 |
orderable: true, |
| 654 |
render: function (data, type, row, meta) { |
680 |
render: function (data, type, row, meta) { |
| 655 |
return row.checkouts_count || 0; |
681 |
return row.checkouts_count || 0; |
| 656 |
} |
682 |
}, |
| 657 |
}, |
683 |
}, |
| 658 |
{ |
684 |
{ |
| 659 |
data: "me.renewals_count", |
685 |
data: "me.renewals_count", |
|
Lines 662-668
var columns = [
Link Here
|
| 662 |
orderable: true, |
688 |
orderable: true, |
| 663 |
render: function (data, type, row, meta) { |
689 |
render: function (data, type, row, meta) { |
| 664 |
return row.renewals_count || 0; |
690 |
return row.renewals_count || 0; |
| 665 |
} |
691 |
}, |
| 666 |
}, |
692 |
}, |
| 667 |
{ |
693 |
{ |
| 668 |
data: "me.localuse", |
694 |
data: "me.localuse", |
|
Lines 671-677
var columns = [
Link Here
|
| 671 |
orderable: true, |
697 |
orderable: true, |
| 672 |
render: function (data, type, row, meta) { |
698 |
render: function (data, type, row, meta) { |
| 673 |
return row.localuse || 0; |
699 |
return row.localuse || 0; |
| 674 |
} |
700 |
}, |
| 675 |
}, |
701 |
}, |
| 676 |
{ |
702 |
{ |
| 677 |
data: "me.acquisition_date", |
703 |
data: "me.acquisition_date", |
|
Lines 681-687
var columns = [
Link Here
|
| 681 |
orderable: true, |
707 |
orderable: true, |
| 682 |
render: function (data, type, row, meta) { |
708 |
render: function (data, type, row, meta) { |
| 683 |
return $date(row.acquisition_date); |
709 |
return $date(row.acquisition_date); |
| 684 |
} |
710 |
}, |
| 685 |
}, |
711 |
}, |
| 686 |
{ |
712 |
{ |
| 687 |
data: "me.last_checkout_date", |
713 |
data: "me.last_checkout_date", |
|
Lines 691-697
var columns = [
Link Here
|
| 691 |
orderable: true, |
717 |
orderable: true, |
| 692 |
render: function (data, type, row, meta) { |
718 |
render: function (data, type, row, meta) { |
| 693 |
return $date(row.last_checkout_date); |
719 |
return $date(row.last_checkout_date); |
| 694 |
} |
720 |
}, |
| 695 |
}, |
721 |
}, |
| 696 |
{ |
722 |
{ |
| 697 |
data: "me.acquisition_source", |
723 |
data: "me.acquisition_source", |
|
Lines 700-706
var columns = [
Link Here
|
| 700 |
orderable: true, |
726 |
orderable: true, |
| 701 |
render: function (data, type, row, meta) { |
727 |
render: function (data, type, row, meta) { |
| 702 |
return escape_str(row._strings.acquisition_source ? row._strings.acquisition_source.str : row.acquisition_source); |
728 |
return escape_str(row._strings.acquisition_source ? row._strings.acquisition_source.str : row.acquisition_source); |
| 703 |
} |
729 |
}, |
| 704 |
}, |
730 |
}, |
| 705 |
{ |
731 |
{ |
| 706 |
data: "me.external_id", |
732 |
data: "me.external_id", |
|
Lines 708-718
var columns = [
Link Here
|
| 708 |
searchable: true, |
734 |
searchable: true, |
| 709 |
orderable: true, |
735 |
orderable: true, |
| 710 |
render: function (data, type, row, meta) { |
736 |
render: function (data, type, row, meta) { |
| 711 |
if ( row.external_id != null ) { |
737 |
if (row.external_id != null) { |
| 712 |
return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=%s&itemnumber=%s#item%s">%s</a>'.format(row.biblio_id, row.item_id, row.item_id, row.external_id); |
738 |
return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=%s&itemnumber=%s#item%s">%s</a>'.format(row.biblio_id, row.item_id, row.item_id, row.external_id); |
| 713 |
} |
739 |
} |
| 714 |
return ''; |
740 |
return ""; |
| 715 |
} |
741 |
}, |
| 716 |
}, |
742 |
}, |
| 717 |
{ |
743 |
{ |
| 718 |
data: "me.uri", |
744 |
data: "me.uri", |
|
Lines 720-739
var columns = [
Link Here
|
| 720 |
searchable: true, |
746 |
searchable: true, |
| 721 |
orderable: true, |
747 |
orderable: true, |
| 722 |
render: function (data, type, row, meta) { |
748 |
render: function (data, type, row, meta) { |
| 723 |
if ( !row.uri ) return ""; |
749 |
if (!row.uri) return ""; |
| 724 |
|
750 |
|
| 725 |
let nodes = ''; |
751 |
let nodes = ""; |
| 726 |
if ( row.uri.split(' \| ').length > 1 ) { |
752 |
if (row.uri.split(" \| ").length > 1) { |
| 727 |
row.uri.split(' \| ').forEach((uri, i) => { |
753 |
row.uri.split(" \| ").forEach((uri, i) => { |
| 728 |
let node = safe_link(uri,uri); |
754 |
let node = safe_link(uri, uri); |
| 729 |
nodes += node.outerHTML + "<br>"; |
755 |
nodes += node.outerHTML + "<br>"; |
| 730 |
}); |
756 |
}); |
| 731 |
} else { |
757 |
} else { |
| 732 |
let node = safe_link(row.uri,url_link_text); |
758 |
let node = safe_link(row.uri, url_link_text); |
| 733 |
nodes += node.outerHTML; |
759 |
nodes += node.outerHTML; |
| 734 |
} |
760 |
} |
| 735 |
return nodes; |
761 |
return nodes; |
| 736 |
} |
762 |
}, |
| 737 |
}, |
763 |
}, |
| 738 |
{ |
764 |
{ |
| 739 |
data: "me.copy_number", |
765 |
data: "me.copy_number", |
|
Lines 742-748
var columns = [
Link Here
|
| 742 |
orderable: true, |
768 |
orderable: true, |
| 743 |
render: function (data, type, row, meta) { |
769 |
render: function (data, type, row, meta) { |
| 744 |
return escape_str(row._strings.copy_number ? row._strings.copy_number.str : row.copy_number); |
770 |
return escape_str(row._strings.copy_number ? row._strings.copy_number.str : row.copy_number); |
| 745 |
} |
771 |
}, |
| 746 |
}, |
772 |
}, |
| 747 |
{ |
773 |
{ |
| 748 |
data: "me.inventory_number", |
774 |
data: "me.inventory_number", |
|
Lines 751-757
var columns = [
Link Here
|
| 751 |
orderable: true, |
777 |
orderable: true, |
| 752 |
render: function (data, type, row, meta) { |
778 |
render: function (data, type, row, meta) { |
| 753 |
return escape_str(row.inventory_number); |
779 |
return escape_str(row.inventory_number); |
| 754 |
} |
780 |
}, |
| 755 |
}, |
781 |
}, |
| 756 |
{ |
782 |
{ |
| 757 |
data: "me.materials_notes", |
783 |
data: "me.materials_notes", |
|
Lines 760-766
var columns = [
Link Here
|
| 760 |
orderable: true, |
786 |
orderable: true, |
| 761 |
render: function (data, type, row, meta) { |
787 |
render: function (data, type, row, meta) { |
| 762 |
return escape_str(row.materials_notes); |
788 |
return escape_str(row.materials_notes); |
| 763 |
} |
789 |
}, |
| 764 |
}, |
790 |
}, |
| 765 |
{ |
791 |
{ |
| 766 |
data: "me.public_notes", |
792 |
data: "me.public_notes", |
|
Lines 768-775
var columns = [
Link Here
|
| 768 |
searchable: true, |
794 |
searchable: true, |
| 769 |
orderable: true, |
795 |
orderable: true, |
| 770 |
render: function (data, type, row, meta) { |
796 |
render: function (data, type, row, meta) { |
| 771 |
return row.public_notes ? escape_str(row.public_notes).replaceAll('\n', '<br />') : ''; |
797 |
return row.public_notes ? escape_str(row.public_notes).replaceAll("\n", "<br />") : ""; |
| 772 |
} |
798 |
}, |
| 773 |
}, |
799 |
}, |
| 774 |
{ |
800 |
{ |
| 775 |
data: "me.internal_notes", |
801 |
data: "me.internal_notes", |
|
Lines 778-958
var columns = [
Link Here
|
| 778 |
orderable: true, |
804 |
orderable: true, |
| 779 |
render: function (data, type, row, meta) { |
805 |
render: function (data, type, row, meta) { |
| 780 |
return escape_str(row.internal_notes); |
806 |
return escape_str(row.internal_notes); |
| 781 |
} |
807 |
}, |
| 782 |
}, |
|
|
| 783 |
...(prefs.EasyAnalyticalRecords? |
| 784 |
[{ |
| 785 |
data: "biblio.title", |
| 786 |
searchable: false, |
| 787 |
orderable: true, |
| 788 |
render: function (data, type, row, meta) { |
| 789 |
if ( row.biblio_id == biblionumber ) return ""; |
| 790 |
return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title); |
| 791 |
} |
| 792 |
}]:[]), |
| 793 |
...(analyze ? |
| 794 |
[{ |
| 795 |
data: "analytics_count", |
| 796 |
searchable: false, |
| 797 |
orderable: false, |
| 798 |
render: function (data, type, row, meta) { |
| 799 |
if (row.analytics_count == 0) return "" |
| 800 |
return '<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=%s">%s</a>'.format(row.item_id, _("%s analytics").format(row.analytics_count)); |
| 801 |
} |
| 802 |
}, |
808 |
}, |
|
|
809 |
...(prefs.EasyAnalyticalRecords |
| 810 |
? [ |
| 811 |
{ |
| 812 |
data: "biblio.title", |
| 813 |
searchable: false, |
| 814 |
orderable: true, |
| 815 |
render: function (data, type, row, meta) { |
| 816 |
if (row.biblio_id == biblionumber) return ""; |
| 817 |
return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title); |
| 818 |
}, |
| 819 |
}, |
| 820 |
] |
| 821 |
: []), |
| 822 |
...(analyze |
| 823 |
? [ |
| 824 |
{ |
| 825 |
data: "analytics_count", |
| 826 |
searchable: false, |
| 827 |
orderable: false, |
| 828 |
render: function (data, type, row, meta) { |
| 829 |
if (row.analytics_count == 0) return ""; |
| 830 |
return '<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=%s">%s</a>'.format(row.item_id, _("%s analytics").format(row.analytics_count)); |
| 831 |
}, |
| 832 |
}, |
| 833 |
{ |
| 834 |
data: "analytics_count", // create analytics link |
| 835 |
searchable: false, |
| 836 |
orderable: false, |
| 837 |
render: function (data, type, row, meta) { |
| 838 |
return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&hostitemnumber=%s">%s</a>'.format(row.biblio_id, row.item_id, _("Create analytics")); |
| 839 |
}, |
| 840 |
}, |
| 841 |
] |
| 842 |
: []), |
| 843 |
...(prefs.UseCourseReserves |
| 844 |
? [ |
| 845 |
{ |
| 846 |
data: "course_item.course_reserves.course.course_name", |
| 847 |
searchable: true, |
| 848 |
orderable: true, |
| 849 |
render: function (data, type, row, meta) { |
| 850 |
let nodes = ""; |
| 851 |
if (!row.course_item) return nodes; |
| 852 |
row.course_item.course_reserves.forEach((cr, i) => { |
| 853 |
let c = cr.course; |
| 854 |
if (c.enabled != "yes") return; |
| 855 |
nodes += "<p>"; |
| 856 |
nodes += '<a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=%s">'.format(c.course_id); |
| 857 |
nodes += escape_str(c.course_name); |
| 858 |
if (c.section) { |
| 859 |
nodes += " " + escape_str(c.section); |
| 860 |
} |
| 861 |
if (c.term) { |
| 862 |
nodes += " " + av_courses_term.get(c.term.toString()); |
| 863 |
} |
| 864 |
nodes += "</p>"; |
| 865 |
}); |
| 866 |
return nodes; |
| 867 |
}, |
| 868 |
}, |
| 869 |
] |
| 870 |
: []), |
| 871 |
...(prefs.SpineLabelShowPrintOnBibDetails |
| 872 |
? [ |
| 873 |
{ |
| 874 |
data: "", |
| 875 |
searchable: false, |
| 876 |
orderable: false, |
| 877 |
render: function (data, type, row, meta) { |
| 878 |
return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> Print label</a>'.format(escape_str(row.external_id)); |
| 879 |
}, |
| 880 |
}, |
| 881 |
] |
| 882 |
: []), |
| 883 |
...(permissions.CAN_user_editcatalogue_edit_items |
| 884 |
? [ |
| 885 |
{ |
| 886 |
data: function (row, type, val, meta) { |
| 887 |
let nodes = ""; |
| 888 |
if (can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length) { |
| 889 |
if (prefs.LocalCoverImages || prefs.OPACLocalCoverImages) { |
| 890 |
nodes += '<div class="btn-group dropup">'; |
| 891 |
nodes += |
| 892 |
' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format( |
| 893 |
row.biblio_id, |
| 894 |
row.item_id, |
| 895 |
_("Edit") |
| 896 |
); |
| 897 |
nodes += ' <ul class="dropdown-menu">'; |
| 898 |
nodes += ' <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format( |
| 899 |
row.item_id, |
| 900 |
_("Upload image") |
| 901 |
); |
| 902 |
nodes += " </ul>"; |
| 903 |
nodes += "</div>"; |
| 904 |
} else { |
| 905 |
nodes += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a>'.format( |
| 906 |
row.biblio_id, |
| 907 |
row.item_id, |
| 908 |
_("Edit") |
| 909 |
); |
| 910 |
} |
| 911 |
} |
| 912 |
if (bundlesEnabled) { |
| 913 |
nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> %s</button>'.format( |
| 914 |
_("Manage bundle (%s|%s)").format(row.bundle_items_not_lost_count, row.bundle_items_lost_count) |
| 915 |
); |
| 916 |
} |
| 917 |
|
| 918 |
return nodes; |
| 919 |
}, |
| 920 |
className: "actions", |
| 921 |
searchable: false, |
| 922 |
orderable: false, |
| 923 |
}, |
| 924 |
] |
| 925 |
: []), |
| 926 |
]; |
| 927 |
var items_table = $("#" + tab_id + "_table").kohaTable( |
| 803 |
{ |
928 |
{ |
| 804 |
data: "analytics_count", // create analytics link |
929 |
ajax: { url: item_table_url }, |
| 805 |
searchable: false, |
930 |
order: [], |
| 806 |
orderable: false, |
931 |
embed, |
| 807 |
render: function (data, type, row, meta) { |
932 |
autoWidth: false, |
| 808 |
return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&hostitemnumber=%s">%s</a>'.format(row.biblio_id, row.item_id, _("Create analytics")); |
933 |
bKohaColumnsUseNames: true, |
| 809 |
} |
934 |
columns, |
| 810 |
}]:[]), |
935 |
initComplete: function (settings, json) { |
| 811 |
...(prefs.UseCourseReserves? |
936 |
itemSelectionBuildActionLinks(tab_id); |
| 812 |
[{ |
937 |
}, |
| 813 |
data: "course_item.course_reserves.course.course_name", |
938 |
drawCallback: function (settings) { |
| 814 |
searchable: true, |
939 |
let api = this.api(); |
| 815 |
orderable: true, |
940 |
$.each($(this).find("tbody tr td:first-child"), function (index, e) { |
| 816 |
render: function (data, type, row, meta) { |
941 |
let tr = $(this).parent(); |
| 817 |
let nodes = ''; |
942 |
let row = api.row(tr).data(); |
| 818 |
if (!row.course_item) return nodes; |
943 |
if (!row) return; // Happen if the table is empty |
| 819 |
row.course_item.course_reserves.forEach((cr, i) => { |
944 |
$(this) |
| 820 |
let c = cr.course; |
945 |
.find("input[name='itemnumber'][type='checkbox']") |
| 821 |
if ( c.enabled != 'yes' ) return; |
946 |
.on("change", function () { |
| 822 |
nodes += '<p>'; |
947 |
let itemnumber = parseInt($(this).val()); |
| 823 |
nodes += '<a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=%s">'.format(c.course_id); |
948 |
if ($(this).prop("checked")) { |
| 824 |
nodes += escape_str(c.course_name); |
949 |
items_selection[tab_id].push(itemnumber); |
| 825 |
if ( c.section ) { |
950 |
} else { |
| 826 |
nodes += ' ' + escape_str(c.section); |
951 |
items_selection[tab_id] = items_selection[tab_id].filter(id => id != itemnumber); |
| 827 |
} |
952 |
} |
| 828 |
if ( c.term ) { |
953 |
itemSelectionBuildActionLinks(tab_id); |
| 829 |
nodes += ' ' + av_courses_term.get(c.term.toString()); |
954 |
}); |
| 830 |
} |
|
|
| 831 |
nodes += '</p>'; |
| 832 |
}); |
955 |
}); |
| 833 |
return nodes; |
956 |
|
| 834 |
} |
957 |
if (!add_filters && settings._iRecordsDisplay == settings._iRecordsTotal && settings._iDisplayLength >= settings._iRecordsDisplay) { |
| 835 |
}]:[]), |
958 |
let container = $(this).parent(); |
| 836 |
...(prefs.SpineLabelShowPrintOnBibDetails? |
959 |
container.find(".dt-info").remove(); |
| 837 |
[{ |
960 |
container.find(".table_entries").remove(); |
| 838 |
data: "", |
961 |
container.find(".dataTables_filter").remove(); |
| 839 |
searchable: false, |
962 |
container.find(".dt_button_clear_filter").remove(); |
| 840 |
orderable: false, |
963 |
container.find(".bottom.pager").remove(); |
| 841 |
render: function (data, type, row, meta) { |
|
|
| 842 |
return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> Print label</a>'.format(escape_str(row.external_id)); |
| 843 |
} |
| 844 |
}]:[]), |
| 845 |
...(permissions.CAN_user_editcatalogue_edit_items ? |
| 846 |
[{ |
| 847 |
data: function( row, type, val, meta ) { |
| 848 |
let nodes = ''; |
| 849 |
if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){ |
| 850 |
if (prefs.LocalCoverImages || prefs.OPACLocalCoverImages){ |
| 851 |
nodes += '<div class="btn-group dropup">'; |
| 852 |
nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit")); |
| 853 |
nodes += ' <ul class="dropdown-menu">'; |
| 854 |
nodes += ' <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image")); |
| 855 |
nodes += ' </ul>'; |
| 856 |
nodes += '</div>'; |
| 857 |
} else { |
| 858 |
nodes += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a>'.format(row.biblio_id, row.item_id, _("Edit")); |
| 859 |
} |
| 860 |
} |
| 861 |
if (bundlesEnabled){ |
| 862 |
nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> %s</button>'.format(_("Manage bundle (%s|%s)").format(row.bundle_items_not_lost_count, row.bundle_items_lost_count)); |
| 863 |
} |
964 |
} |
| 864 |
|
965 |
|
| 865 |
return nodes; |
966 |
if (prefs.SpineLabelShowPrintOnBibDetails) { |
| 866 |
}, |
967 |
$(".print-label").on("click", function (e) { |
| 867 |
className: "actions", |
968 |
e.preventDefault(); |
| 868 |
searchable: false, |
969 |
link = $(this).attr("href"); |
| 869 |
orderable: false |
970 |
openWindow(link, "Print spine label", 400, 400); |
| 870 |
}]:[]) |
|
|
| 871 |
]; |
| 872 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
| 873 |
ajax: { url: item_table_url }, |
| 874 |
order: [], |
| 875 |
embed, |
| 876 |
autoWidth: false, |
| 877 |
bKohaColumnsUseNames: true, |
| 878 |
columns, |
| 879 |
initComplete: function( settings, json ){ |
| 880 |
itemSelectionBuildActionLinks(tab_id); |
| 881 |
}, |
| 882 |
drawCallback: function(settings){ |
| 883 |
let api = this.api(); |
| 884 |
$.each( |
| 885 |
$(this).find("tbody tr td:first-child"), |
| 886 |
function (index, e) { |
| 887 |
let tr = $(this).parent() |
| 888 |
let row = api.row(tr).data() |
| 889 |
if (!row) return // Happen if the table is empty |
| 890 |
$(this).find("input[name='itemnumber'][type='checkbox']").on("change", function(){ |
| 891 |
let itemnumber = parseInt($(this).val()); |
| 892 |
if( $(this).prop("checked") ){ |
| 893 |
items_selection[tab_id].push(itemnumber); |
| 894 |
} else { |
| 895 |
items_selection[tab_id] = items_selection[tab_id].filter( id => id != itemnumber ); |
| 896 |
} |
| 897 |
itemSelectionBuildActionLinks(tab_id); |
| 898 |
}); |
971 |
}); |
| 899 |
} |
972 |
} |
| 900 |
); |
|
|
| 901 |
|
| 902 |
if (!add_filters && settings._iRecordsDisplay == settings._iRecordsTotal && settings._iDisplayLength >= settings._iRecordsDisplay){ |
| 903 |
let container = $(this).parent(); |
| 904 |
container.find(".dt-info").remove(); |
| 905 |
container.find(".table_entries").remove(); |
| 906 |
container.find(".dataTables_filter").remove(); |
| 907 |
container.find(".dt_button_clear_filter").remove(); |
| 908 |
container.find(".bottom.pager").remove(); |
| 909 |
} |
| 910 |
|
973 |
|
| 911 |
if (prefs.SpineLabelShowPrintOnBibDetails){ |
974 |
if (api.data().length) { |
| 912 |
$(".print-label").on("click", function(e){ |
975 |
update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); |
| 913 |
e.preventDefault(); |
976 |
} |
| 914 |
link = $(this).attr("href"); |
|
|
| 915 |
openWindow(link,"Print spine label",400,400); |
| 916 |
}); |
| 917 |
} |
| 918 |
|
| 919 |
if ( api.data().length ) { |
| 920 |
update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); |
| 921 |
} |
| 922 |
|
977 |
|
| 923 |
if ( drawcallback ) { drawcallback(this); } |
978 |
if (drawcallback) { |
|
|
979 |
drawcallback(this); |
| 980 |
} |
| 981 |
}, |
| 982 |
...dt_options, |
| 924 |
}, |
983 |
}, |
| 925 |
...dt_options, |
984 |
items_table_settings[tab_id], |
| 926 |
}, |
985 |
add_filters, |
| 927 |
items_table_settings[tab_id], |
986 |
default_filters, |
| 928 |
add_filters, |
987 |
filters_options |
| 929 |
default_filters, |
|
|
| 930 |
filters_options, |
| 931 |
); |
988 |
); |
| 932 |
|
989 |
|
| 933 |
table_dt = items_table.DataTable(); |
990 |
table_dt = items_table.DataTable(); |
| 934 |
table_dt.on("column-visibility.dt", function(e, settings, column, state, recalc ){ |
991 |
table_dt.on("column-visibility.dt", function (e, settings, column, state, recalc) { |
| 935 |
if (recalc === false) return; |
992 |
if (recalc === false) return; |
| 936 |
|
993 |
|
| 937 |
if ( filters_shown ) { |
994 |
if (filters_shown) { |
| 938 |
_dt_add_filters(this, table_dt, filters_options); |
995 |
_dt_add_filters(this, table_dt, filters_options); |
| 939 |
} |
996 |
} |
| 940 |
|
997 |
|
| 941 |
user_colvis[tab_id][column] = state; |
998 |
user_colvis[tab_id][column] = state; |
| 942 |
|
|
|
| 943 |
}); |
999 |
}); |
| 944 |
return items_table; |
1000 |
return items_table; |
| 945 |
} |
1001 |
} |
| 946 |
function safe_link(uri,link_text) { |
1002 |
function safe_link(uri, link_text) { |
| 947 |
let node = document.createElement('a'); |
1003 |
let node = document.createElement("a"); |
| 948 |
let url_str = '#'; |
1004 |
let url_str = "#"; |
| 949 |
try { |
1005 |
try { |
| 950 |
const safe_url = new URL(uri); |
1006 |
const safe_url = new URL(uri); |
| 951 |
url_str = safe_url.href; |
1007 |
url_str = safe_url.href; |
| 952 |
} catch (e) { |
1008 |
} catch (e) { |
| 953 |
//console.error('Invalid URL:', e); |
1009 |
//console.error('Invalid URL:', e); |
| 954 |
} |
1010 |
} |
| 955 |
node.setAttribute('href',url_str); |
1011 |
node.setAttribute("href", url_str); |
| 956 |
node.textContent = link_text; |
1012 |
node.textContent = link_text; |
| 957 |
return node; |
1013 |
return node; |
| 958 |
} |
1014 |
} |