|
Lines 9-20
Link Here
|
| 9 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %] |
9 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %] |
| 10 |
[% Asset.css("css/datatables.css") %] |
10 |
[% Asset.css("css/datatables.css") %] |
| 11 |
[% INCLUDE 'datatables.inc' %] |
11 |
[% INCLUDE 'datatables.inc' %] |
|
|
12 |
[% INCLUDE 'calendar.inc' %] |
| 12 |
<script type="text/javascript"> |
13 |
<script type="text/javascript"> |
| 13 |
//<![CDATA[ |
14 |
//<![CDATA[ |
| 14 |
$(document).ready(function() { |
15 |
$(document).ready(function() { |
| 15 |
|
16 |
|
| 16 |
// Illview Datatable setup |
17 |
// Illview Datatable setup |
| 17 |
|
18 |
|
|
|
19 |
var table; |
| 20 |
|
| 21 |
// Filters that are active |
| 22 |
var activeFilters = {}; |
| 23 |
|
| 24 |
// Date format for datepickers |
| 25 |
var dateMap = { |
| 26 |
dmydot: 'dd.mm.yy', |
| 27 |
iso: 'yy-mm-dd', |
| 28 |
metric: 'dd/mm/yy', |
| 29 |
us: 'mm/dd/yy' |
| 30 |
}; |
| 31 |
var dateFormat = dateMap['[% Koha.Preference('dateformat') %]']; |
| 32 |
$('#illfilter_dateplaced, #illfilter_datemodified').datepicker( |
| 33 |
'option', 'dateFormat', dateFormat |
| 34 |
); |
| 35 |
|
| 18 |
// Fields we don't want to display |
36 |
// Fields we don't want to display |
| 19 |
var ignore = [ |
37 |
var ignore = [ |
| 20 |
'accessurl', |
38 |
'accessurl', |
|
Lines 26-32
Link Here
|
| 26 |
'medium', |
44 |
'medium', |
| 27 |
'notesopac', |
45 |
'notesopac', |
| 28 |
'notesstaff', |
46 |
'notesstaff', |
| 29 |
'placed', |
|
|
| 30 |
'replied' |
47 |
'replied' |
| 31 |
]; |
48 |
]; |
| 32 |
|
49 |
|
|
Lines 45-58
Link Here
|
| 45 |
'metadata_Author', |
62 |
'metadata_Author', |
| 46 |
'metadata_Title', |
63 |
'metadata_Title', |
| 47 |
'borrowername', |
64 |
'borrowername', |
|
|
65 |
'patron_cardnumber', |
| 48 |
'biblio_id', |
66 |
'biblio_id', |
| 49 |
'library', |
67 |
'library', |
| 50 |
'status', |
68 |
'status', |
|
|
69 |
'placed', |
| 70 |
'placed_formatted', |
| 51 |
'updated', |
71 |
'updated', |
|
|
72 |
'updated_formatted', |
| 52 |
'illrequest_id', |
73 |
'illrequest_id', |
| 53 |
'action' |
74 |
'action' |
| 54 |
]; |
75 |
]; |
| 55 |
|
76 |
|
|
|
77 |
// Filterable columns |
| 78 |
var filterable = { |
| 79 |
status: { |
| 80 |
prep: function(tableData, oData) { |
| 81 |
var uniques = {}; |
| 82 |
tableData.forEach(function(row) { |
| 83 |
var resolvedName = getStatusName( |
| 84 |
oData[0].capabilities[row.status].name |
| 85 |
); |
| 86 |
uniques[resolvedName] = 1 |
| 87 |
}); |
| 88 |
Object.keys(uniques).sort().forEach(function(unique) { |
| 89 |
$('#illfilter_status').append( |
| 90 |
'<option value="' + unique + |
| 91 |
'">' + unique + '</option>' |
| 92 |
); |
| 93 |
}); |
| 94 |
}, |
| 95 |
listener: function() { |
| 96 |
var me = 'status'; |
| 97 |
$('#illfilter_status').change(function() { |
| 98 |
var sel = $('#illfilter_status option:selected').val(); |
| 99 |
if (sel && sel.length > 0) { |
| 100 |
activeFilters[me] = function() { |
| 101 |
table.column(6).search(sel); |
| 102 |
} |
| 103 |
} else { |
| 104 |
if (activeFilters.hasOwnProperty(me)) { |
| 105 |
delete activeFilters[me]; |
| 106 |
} |
| 107 |
} |
| 108 |
}); |
| 109 |
}, |
| 110 |
clear: function() { |
| 111 |
$('#illfilter_status').val(''); |
| 112 |
} |
| 113 |
}, |
| 114 |
pickupBranch: { |
| 115 |
prep: function(tableData, oData) { |
| 116 |
var uniques = {}; |
| 117 |
tableData.forEach(function(row) { |
| 118 |
uniques[row.library.branchname] = 1 |
| 119 |
}); |
| 120 |
Object.keys(uniques).sort().forEach(function(unique) { |
| 121 |
$('#illfilter_branchname').append( |
| 122 |
'<option value="' + unique + |
| 123 |
'">' + unique + '</option>' |
| 124 |
); |
| 125 |
}); |
| 126 |
}, |
| 127 |
listener: function() { |
| 128 |
var me = 'pickupBranch'; |
| 129 |
$('#illfilter_branchname').change(function() { |
| 130 |
var sel = $('#illfilter_branchname option:selected').val(); |
| 131 |
if (sel && sel.length > 0) { |
| 132 |
activeFilters[me] = function() { |
| 133 |
table.column(5).search(sel); |
| 134 |
} |
| 135 |
} else { |
| 136 |
if (activeFilters.hasOwnProperty(me)) { |
| 137 |
delete activeFilters[me]; |
| 138 |
} |
| 139 |
} |
| 140 |
}); |
| 141 |
}, |
| 142 |
clear: function() { |
| 143 |
$('#illfilter_branchname').val(''); |
| 144 |
} |
| 145 |
}, |
| 146 |
barcode: { |
| 147 |
listener: function() { |
| 148 |
var me = 'barcode'; |
| 149 |
$('#illfilter_barcode').change(function() { |
| 150 |
var val = $('#illfilter_barcode').val(); |
| 151 |
if (val && val.length > 0) { |
| 152 |
activeFilters[me] = function() { |
| 153 |
table.column(3).search(val); |
| 154 |
} |
| 155 |
} else { |
| 156 |
if (activeFilters.hasOwnProperty(me)) { |
| 157 |
delete activeFilters[me]; |
| 158 |
} |
| 159 |
} |
| 160 |
}); |
| 161 |
}, |
| 162 |
clear: function() { |
| 163 |
$('#illfilter_barcode').val(''); |
| 164 |
} |
| 165 |
}, |
| 166 |
dateModified: { |
| 167 |
listener: function() { |
| 168 |
var me = 'dateModified'; |
| 169 |
$('#illfilter_datemodified').change(function() { |
| 170 |
var val = $('#illfilter_datemodified').val(); |
| 171 |
if (val && val.length > 0) { |
| 172 |
activeFilters[me] = function() { |
| 173 |
table.column(10).search(val); |
| 174 |
} |
| 175 |
} else { |
| 176 |
if (activeFilters.hasOwnProperty(me)) { |
| 177 |
delete activeFilters[me]; |
| 178 |
} |
| 179 |
} |
| 180 |
}); |
| 181 |
}, |
| 182 |
clear: function() { |
| 183 |
$('#illfilter_datemodified').val(''); |
| 184 |
} |
| 185 |
}, |
| 186 |
datePlaced: { |
| 187 |
listener: function() { |
| 188 |
var me = 'datePlaced'; |
| 189 |
$('#illfilter_dateplaced').change(function() { |
| 190 |
var val = $('#illfilter_dateplaced').val(); |
| 191 |
if (val && val.length > 0) { |
| 192 |
activeFilters[me] = function() { |
| 193 |
table.column(8).search(val); |
| 194 |
} |
| 195 |
} else { |
| 196 |
if (activeFilters.hasOwnProperty(me)) { |
| 197 |
delete activeFilters[me]; |
| 198 |
} |
| 199 |
} |
| 200 |
}); |
| 201 |
}, |
| 202 |
clear: function() { |
| 203 |
$('#illfilter_dateplaced').val(''); |
| 204 |
} |
| 205 |
} |
| 206 |
}; |
| 207 |
|
| 56 |
// Remove any fields we're ignoring |
208 |
// Remove any fields we're ignoring |
| 57 |
var removeIgnore = function(dataObj) { |
209 |
var removeIgnore = function(dataObj) { |
| 58 |
dataObj.forEach(function(thisRow) { |
210 |
dataObj.forEach(function(thisRow) { |
|
Lines 132-162
Link Here
|
| 132 |
var status_name = meta.settings.oInit.originalData[0].capabilities[ |
284 |
var status_name = meta.settings.oInit.originalData[0].capabilities[ |
| 133 |
row.status |
285 |
row.status |
| 134 |
].name; |
286 |
].name; |
| 135 |
switch( status_name ) { |
287 |
return getStatusName(status_name); |
| 136 |
case "New request": |
|
|
| 137 |
return _("New request"); |
| 138 |
case "Requested": |
| 139 |
return _("Requested"); |
| 140 |
case "Requested from partners": |
| 141 |
return _("Requested from partners"); |
| 142 |
case "Request reverted": |
| 143 |
return _("Request reverted"); |
| 144 |
case "Queued request": |
| 145 |
return _("Queued request"); |
| 146 |
case "Cancellation requested": |
| 147 |
return _("Cancellation requested"); |
| 148 |
case "Completed": |
| 149 |
return _("Completed"); |
| 150 |
case "Delete request": |
| 151 |
return _("Delete request"); |
| 152 |
default: |
| 153 |
return status_name; |
| 154 |
} |
| 155 |
} else { |
288 |
} else { |
| 156 |
return ''; |
289 |
return ''; |
| 157 |
} |
290 |
} |
| 158 |
}; |
291 |
}; |
| 159 |
|
292 |
|
|
|
293 |
var getStatusName = function(origName) { |
| 294 |
switch( origName ) { |
| 295 |
case "New request": |
| 296 |
return _("New request"); |
| 297 |
case "Requested": |
| 298 |
return _("Requested"); |
| 299 |
case "Requested from partners": |
| 300 |
return _("Requested from partners"); |
| 301 |
case "Request reverted": |
| 302 |
return _("Request reverted"); |
| 303 |
case "Queued request": |
| 304 |
return _("Queued request"); |
| 305 |
case "Cancellation requested": |
| 306 |
return _("Cancellation requested"); |
| 307 |
case "Completed": |
| 308 |
return _("Completed"); |
| 309 |
case "Delete request": |
| 310 |
return _("Delete request"); |
| 311 |
default: |
| 312 |
return origName; |
| 313 |
} |
| 314 |
}; |
| 315 |
|
| 160 |
// Render function for creating a row's action link |
316 |
// Render function for creating a row's action link |
| 161 |
var createActionLink = function(data, type, row) { |
317 |
var createActionLink = function(data, type, row) { |
| 162 |
return '<a class="btn btn-default btn-sm" ' + |
318 |
return '<a class="btn btn-default btn-sm" ' + |
|
Lines 190-195
Link Here
|
| 190 |
library: { |
346 |
library: { |
| 191 |
name: _("Library"), |
347 |
name: _("Library"), |
| 192 |
func: createLibrary |
348 |
func: createLibrary |
|
|
349 |
}, |
| 350 |
updated: { |
| 351 |
name: _("Updated on"), |
| 352 |
}, |
| 353 |
patron_cardnumber: { |
| 354 |
name: _("Patron barcode") |
| 193 |
} |
355 |
} |
| 194 |
}; |
356 |
}; |
| 195 |
|
357 |
|
|
Lines 240-246
Link Here
|
| 240 |
// Create the base column object |
402 |
// Create the base column object |
| 241 |
var colObj = { |
403 |
var colObj = { |
| 242 |
name: thisCol, |
404 |
name: thisCol, |
| 243 |
className: thisCol |
405 |
className: thisCol, |
|
|
406 |
defaultContent: '' |
| 244 |
}; |
407 |
}; |
| 245 |
// We may need to process the data going in this |
408 |
// We may need to process the data going in this |
| 246 |
// column, so do it if necessary |
409 |
// column, so do it if necessary |
|
Lines 256-282
Link Here
|
| 256 |
}); |
419 |
}); |
| 257 |
|
420 |
|
| 258 |
// Initialise the datatable |
421 |
// Initialise the datatable |
| 259 |
$('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, { |
422 |
table = $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, { |
| 260 |
'aoColumnDefs': [ // Last column shouldn't be sortable or searchable |
423 |
'aoColumnDefs': [ |
| 261 |
{ |
424 |
{ // Last column shouldn't be sortable or searchable |
| 262 |
'aTargets': [ 'actions' ], |
425 |
'aTargets': [ 'actions' ], |
| 263 |
'bSortable': false, |
426 |
'bSortable': false, |
| 264 |
'bSearchable': false |
427 |
'bSearchable': false |
| 265 |
}, |
428 |
}, |
|
|
429 |
{ // Hide the two date columns we use just for sorting |
| 430 |
'aTargets': [ 'placed', 'updated' ], |
| 431 |
'bVisible': false, |
| 432 |
'bSearchable': false |
| 433 |
}, |
| 434 |
{ // When sorting 'placed', we want to use the |
| 435 |
// unformatted column |
| 436 |
'aTargets': [ 'placed_formatted'], |
| 437 |
'iDataSort': 7 |
| 438 |
}, |
| 439 |
{ // When sorting 'updated', we want to use the |
| 440 |
// unformatted column |
| 441 |
'aTargets': [ 'updated_formatted'], |
| 442 |
'iDataSort': 9 |
| 443 |
} |
| 266 |
], |
444 |
], |
| 267 |
'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending |
445 |
'aaSorting': [[ 9, 'desc' ]], // Default sort, updated descending |
| 268 |
'processing': true, // Display a message when manipulating |
446 |
'processing': true, // Display a message when manipulating |
| 269 |
'iDisplayLength': 10, // 10 results per page |
447 |
'iDisplayLength': 10, // 10 results per page |
| 270 |
'sPaginationType': "full_numbers", // Pagination display |
448 |
'sPaginationType': "full_numbers", // Pagination display |
| 271 |
'deferRender': true, // Improve performance on big datasets |
449 |
'deferRender': true, // Improve performance on big datasets |
| 272 |
'data': dataCopy, |
450 |
'data': dataCopy, |
| 273 |
'columns': colData, |
451 |
'columns': colData, |
| 274 |
'originalData': data // Enable render functions to access |
452 |
'originalData': data, // Enable render functions to access |
| 275 |
// our original data |
453 |
// our original data |
|
|
454 |
'initComplete': function() { |
| 455 |
|
| 456 |
// Prepare any filter elements that need it |
| 457 |
for (var el in filterable) { |
| 458 |
if (filterable.hasOwnProperty(el)) { |
| 459 |
if (filterable[el].hasOwnProperty('prep')) { |
| 460 |
filterable[el].prep(dataCopy, data); |
| 461 |
} |
| 462 |
if (filterable[el].hasOwnProperty('listener')) { |
| 463 |
filterable[el].listener(); |
| 464 |
} |
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
} |
| 276 |
})); |
469 |
})); |
|
|
470 |
|
| 277 |
} |
471 |
} |
| 278 |
); |
472 |
); |
| 279 |
|
473 |
|
|
|
474 |
var clearSearch = function() { |
| 475 |
table.search('').columns().search(''); |
| 476 |
activeFilters = {}; |
| 477 |
for (var filter in filterable) { |
| 478 |
if ( |
| 479 |
filterable.hasOwnProperty(filter) && |
| 480 |
filterable[filter].hasOwnProperty('clear') |
| 481 |
) { |
| 482 |
filterable[filter].clear(); |
| 483 |
} |
| 484 |
} |
| 485 |
table.draw(); |
| 486 |
}; |
| 487 |
|
| 488 |
// Apply any search filters, or clear any previous |
| 489 |
// ones |
| 490 |
$('#illfilter_form').submit(function(event) { |
| 491 |
event.preventDefault(); |
| 492 |
table.search('').columns().search(''); |
| 493 |
for (var active in activeFilters) { |
| 494 |
if (activeFilters.hasOwnProperty(active)) { |
| 495 |
activeFilters[active](); |
| 496 |
} |
| 497 |
} |
| 498 |
table.draw(); |
| 499 |
}); |
| 500 |
|
| 501 |
// Clear all filters |
| 502 |
$('#clear_search').click(function() { |
| 503 |
clearSearch(); |
| 504 |
}); |
| 505 |
|
| 280 |
}); |
506 |
}); |
| 281 |
//]]> |
507 |
//]]> |
| 282 |
</script> |
508 |
</script> |
|
Lines 298-303
Link Here
|
| 298 |
|
524 |
|
| 299 |
<div id="doc3" class="yui-t2"> |
525 |
<div id="doc3" class="yui-t2"> |
| 300 |
<div id="bd"> |
526 |
<div id="bd"> |
|
|
527 |
[% IF query_type == 'illlist' %] |
| 528 |
<div id="illfilter_yui_column" class="yui-b"> |
| 529 |
<form method="get" id="illfilter_form"> |
| 530 |
<fieldset class="brief"> |
| 531 |
<h3>Filters</h3> |
| 532 |
<ol> |
| 533 |
<li> |
| 534 |
<label for="illfilter_status">Status:</label> |
| 535 |
<select name="illfilter_status" id="illfilter_status"> |
| 536 |
<option value=""></option> |
| 537 |
</select> |
| 538 |
</li> |
| 539 |
<li> |
| 540 |
<label for="illfilter_dateplaced">Date placed:</label> |
| 541 |
<input type="text" name="illfilter_dateplaced" id="illfilter_dateplaced" class="datepicker"> |
| 542 |
</li> |
| 543 |
<li> |
| 544 |
<label for="illfilter_datemodified">Updated on:</label> |
| 545 |
<input type="text" name="illfilter_datemodified" id="illfilter_datemodified" class="datepicker"> |
| 546 |
</li> |
| 547 |
<li> |
| 548 |
<label for="illfilter_branchname">Library:</label> |
| 549 |
<select name="illfilter_branchname" id="illfilter_branchname"> |
| 550 |
<option value=""></option> |
| 551 |
</select> |
| 552 |
</li> |
| 553 |
<li> |
| 554 |
<label for="illfilter_barcode">Patron barcode:</label> |
| 555 |
<input type="text" name="illfilter_barcode" id="illfilter_barcode"> |
| 556 |
</li> |
| 557 |
</ol> |
| 558 |
<fieldset class="action"> |
| 559 |
<input type="submit" value="Search" /> |
| 560 |
<input type="button" value="Clear" id="clear_search" /> |
| 561 |
</fieldset> |
| 562 |
</fieldset> |
| 563 |
</form> |
| 564 |
</div> |
| 565 |
[% END %] |
| 301 |
<div id="yui-main"> |
566 |
<div id="yui-main"> |
| 302 |
<div id="interlibraryloans" class="yui-b"> |
567 |
<div id="interlibraryloans" class="yui-b"> |
| 303 |
[% IF !backends_available %] |
568 |
[% IF !backends_available %] |
|
Lines 588-598
Link Here
|
| 588 |
<tr id="illview-header"> |
853 |
<tr id="illview-header"> |
| 589 |
<th>Author</th> |
854 |
<th>Author</th> |
| 590 |
<th>Title</th> |
855 |
<th>Title</th> |
| 591 |
<th>Patron</th> |
856 |
<th>Patron name</th> |
|
|
857 |
<th>Patron barcode</th> |
| 592 |
<th>Biblio ID</th> |
858 |
<th>Biblio ID</th> |
| 593 |
<th>Library</th> |
859 |
<th>Library</th> |
| 594 |
<th>Status</th> |
860 |
<th>Status</th> |
| 595 |
<th>Updated on</th> |
861 |
<th class="placed"> </th> |
|
|
862 |
<th class="placed_formatted">Date placed</th> |
| 863 |
<th class="updated"> </th> |
| 864 |
<th class="updated_formatted">Updated on</th> |
| 596 |
<th>Request number</th> |
865 |
<th>Request number</th> |
| 597 |
<th class="actions"></th> |
866 |
<th class="actions"></th> |
| 598 |
</tr> |
867 |
</tr> |
| 599 |
- |
|
|