Lines 10-21
Link Here
|
10 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
10 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
11 |
[% Asset.css("css/datatables.css") | $raw %] |
11 |
[% Asset.css("css/datatables.css") | $raw %] |
12 |
[% INCLUDE 'datatables.inc' %] |
12 |
[% INCLUDE 'datatables.inc' %] |
13 |
<script> |
13 |
[% INCLUDE 'calendar.inc' %] |
|
|
14 |
<script type="text/javascript"> |
14 |
//<![CDATA[ |
15 |
//<![CDATA[ |
15 |
$(document).ready(function() { |
16 |
$(document).ready(function() { |
16 |
|
17 |
|
17 |
// Illview Datatable setup |
18 |
// Illview Datatable setup |
18 |
|
19 |
|
|
|
20 |
var table; |
21 |
|
22 |
// Filters that are active |
23 |
var activeFilters = {}; |
24 |
|
25 |
// Date format for datepickers |
26 |
var dateMap = { |
27 |
dmydot: 'dd.mm.yy', |
28 |
iso: 'yy-mm-dd', |
29 |
metric: 'dd/mm/yy', |
30 |
us: 'mm/dd/yy' |
31 |
}; |
32 |
var dateFormat = dateMap['[% Koha.Preference('dateformat') %]']; |
33 |
$('#illfilter_dateplaced, #illfilter_datemodified').datepicker( |
34 |
'option', 'dateFormat', dateFormat |
35 |
); |
36 |
|
19 |
// Fields we don't want to display |
37 |
// Fields we don't want to display |
20 |
var ignore = [ |
38 |
var ignore = [ |
21 |
'accessurl', |
39 |
'accessurl', |
Lines 27-33
Link Here
|
27 |
'medium', |
45 |
'medium', |
28 |
'notesopac', |
46 |
'notesopac', |
29 |
'notesstaff', |
47 |
'notesstaff', |
30 |
'placed', |
|
|
31 |
'replied' |
48 |
'replied' |
32 |
]; |
49 |
]; |
33 |
|
50 |
|
Lines 46-60
Link Here
|
46 |
'metadata_author', |
63 |
'metadata_author', |
47 |
'metadata_title', |
64 |
'metadata_title', |
48 |
'borrowername', |
65 |
'borrowername', |
|
|
66 |
'patron_cardnumber', |
49 |
'biblio_id', |
67 |
'biblio_id', |
50 |
'library', |
68 |
'library', |
51 |
'status', |
69 |
'status', |
|
|
70 |
'placed', |
71 |
'placed_formatted', |
52 |
'updated', |
72 |
'updated', |
|
|
73 |
'updated_formatted', |
53 |
'illrequest_id', |
74 |
'illrequest_id', |
54 |
'comments', |
75 |
'comments', |
55 |
'action' // Action should always be last |
76 |
'action' // Action should always be last |
56 |
]; |
77 |
]; |
57 |
|
78 |
|
|
|
79 |
// Filterable columns |
80 |
var filterable = { |
81 |
status: { |
82 |
prep: function(tableData, oData) { |
83 |
var uniques = {}; |
84 |
tableData.forEach(function(row) { |
85 |
var resolvedName = getStatusName( |
86 |
oData[0].capabilities[row.status].name |
87 |
); |
88 |
uniques[resolvedName] = 1 |
89 |
}); |
90 |
Object.keys(uniques).sort().forEach(function(unique) { |
91 |
$('#illfilter_status').append( |
92 |
'<option value="' + unique + |
93 |
'">' + unique + '</option>' |
94 |
); |
95 |
}); |
96 |
}, |
97 |
listener: function() { |
98 |
var me = 'status'; |
99 |
$('#illfilter_status').change(function() { |
100 |
var sel = $('#illfilter_status option:selected').val(); |
101 |
if (sel && sel.length > 0) { |
102 |
activeFilters[me] = function() { |
103 |
table.column(6).search(sel); |
104 |
} |
105 |
} else { |
106 |
if (activeFilters.hasOwnProperty(me)) { |
107 |
delete activeFilters[me]; |
108 |
} |
109 |
} |
110 |
}); |
111 |
}, |
112 |
clear: function() { |
113 |
$('#illfilter_status').val(''); |
114 |
} |
115 |
}, |
116 |
pickupBranch: { |
117 |
prep: function(tableData, oData) { |
118 |
var uniques = {}; |
119 |
tableData.forEach(function(row) { |
120 |
uniques[row.library.branchname] = 1 |
121 |
}); |
122 |
Object.keys(uniques).sort().forEach(function(unique) { |
123 |
$('#illfilter_branchname').append( |
124 |
'<option value="' + unique + |
125 |
'">' + unique + '</option>' |
126 |
); |
127 |
}); |
128 |
}, |
129 |
listener: function() { |
130 |
var me = 'pickupBranch'; |
131 |
$('#illfilter_branchname').change(function() { |
132 |
var sel = $('#illfilter_branchname option:selected').val(); |
133 |
if (sel && sel.length > 0) { |
134 |
activeFilters[me] = function() { |
135 |
table.column(5).search(sel); |
136 |
} |
137 |
} else { |
138 |
if (activeFilters.hasOwnProperty(me)) { |
139 |
delete activeFilters[me]; |
140 |
} |
141 |
} |
142 |
}); |
143 |
}, |
144 |
clear: function() { |
145 |
$('#illfilter_branchname').val(''); |
146 |
} |
147 |
}, |
148 |
barcode: { |
149 |
listener: function() { |
150 |
var me = 'barcode'; |
151 |
$('#illfilter_barcode').change(function() { |
152 |
var val = $('#illfilter_barcode').val(); |
153 |
if (val && val.length > 0) { |
154 |
activeFilters[me] = function() { |
155 |
table.column(3).search(val); |
156 |
} |
157 |
} else { |
158 |
if (activeFilters.hasOwnProperty(me)) { |
159 |
delete activeFilters[me]; |
160 |
} |
161 |
} |
162 |
}); |
163 |
}, |
164 |
clear: function() { |
165 |
$('#illfilter_barcode').val(''); |
166 |
} |
167 |
}, |
168 |
dateModified: { |
169 |
listener: function() { |
170 |
var me = 'dateModified'; |
171 |
$('#illfilter_datemodified').change(function() { |
172 |
var val = $('#illfilter_datemodified').val(); |
173 |
if (val && val.length > 0) { |
174 |
activeFilters[me] = function() { |
175 |
table.column(10).search(val); |
176 |
} |
177 |
} else { |
178 |
if (activeFilters.hasOwnProperty(me)) { |
179 |
delete activeFilters[me]; |
180 |
} |
181 |
} |
182 |
}); |
183 |
}, |
184 |
clear: function() { |
185 |
$('#illfilter_datemodified').val(''); |
186 |
} |
187 |
}, |
188 |
datePlaced: { |
189 |
listener: function() { |
190 |
var me = 'datePlaced'; |
191 |
$('#illfilter_dateplaced').change(function() { |
192 |
var val = $('#illfilter_dateplaced').val(); |
193 |
if (val && val.length > 0) { |
194 |
activeFilters[me] = function() { |
195 |
table.column(8).search(val); |
196 |
} |
197 |
} else { |
198 |
if (activeFilters.hasOwnProperty(me)) { |
199 |
delete activeFilters[me]; |
200 |
} |
201 |
} |
202 |
}); |
203 |
}, |
204 |
clear: function() { |
205 |
$('#illfilter_dateplaced').val(''); |
206 |
} |
207 |
} |
208 |
}; |
209 |
|
58 |
// Remove any fields we're ignoring |
210 |
// Remove any fields we're ignoring |
59 |
var removeIgnore = function(dataObj) { |
211 |
var removeIgnore = function(dataObj) { |
60 |
dataObj.forEach(function(thisRow) { |
212 |
dataObj.forEach(function(thisRow) { |
Lines 147-177
Link Here
|
147 |
var status_name = meta.settings.oInit.originalData[0].capabilities[ |
299 |
var status_name = meta.settings.oInit.originalData[0].capabilities[ |
148 |
row.status |
300 |
row.status |
149 |
].name; |
301 |
].name; |
150 |
switch( status_name ) { |
302 |
return getStatusName(status_name); |
151 |
case "New request": |
|
|
152 |
return _("New request"); |
153 |
case "Requested": |
154 |
return _("Requested"); |
155 |
case "Requested from partners": |
156 |
return _("Requested from partners"); |
157 |
case "Request reverted": |
158 |
return _("Request reverted"); |
159 |
case "Queued request": |
160 |
return _("Queued request"); |
161 |
case "Cancellation requested": |
162 |
return _("Cancellation requested"); |
163 |
case "Completed": |
164 |
return _("Completed"); |
165 |
case "Delete request": |
166 |
return _("Delete request"); |
167 |
default: |
168 |
return status_name; |
169 |
} |
170 |
} else { |
303 |
} else { |
171 |
return ''; |
304 |
return ''; |
172 |
} |
305 |
} |
173 |
}; |
306 |
}; |
174 |
|
307 |
|
|
|
308 |
var getStatusName = function(origName) { |
309 |
switch( origName ) { |
310 |
case "New request": |
311 |
return _("New request"); |
312 |
case "Requested": |
313 |
return _("Requested"); |
314 |
case "Requested from partners": |
315 |
return _("Requested from partners"); |
316 |
case "Request reverted": |
317 |
return _("Request reverted"); |
318 |
case "Queued request": |
319 |
return _("Queued request"); |
320 |
case "Cancellation requested": |
321 |
return _("Cancellation requested"); |
322 |
case "Completed": |
323 |
return _("Completed"); |
324 |
case "Delete request": |
325 |
return _("Delete request"); |
326 |
default: |
327 |
return origName; |
328 |
} |
329 |
}; |
330 |
|
175 |
// Render function for creating a row's action link |
331 |
// Render function for creating a row's action link |
176 |
var createActionLink = function(data, type, row) { |
332 |
var createActionLink = function(data, type, row) { |
177 |
return '<a class="btn btn-default btn-sm" ' + |
333 |
return '<a class="btn btn-default btn-sm" ' + |
Lines 206-211
Link Here
|
206 |
library: { |
362 |
library: { |
207 |
name: _("Library"), |
363 |
name: _("Library"), |
208 |
func: createLibrary |
364 |
func: createLibrary |
|
|
365 |
}, |
366 |
updated: { |
367 |
name: _("Updated on"), |
368 |
}, |
369 |
patron_cardnumber: { |
370 |
name: _("Patron barcode") |
209 |
} |
371 |
} |
210 |
}; |
372 |
}; |
211 |
|
373 |
|
Lines 268-274
Link Here
|
268 |
// Create the base column object |
430 |
// Create the base column object |
269 |
var colObj = { |
431 |
var colObj = { |
270 |
name: thisCol, |
432 |
name: thisCol, |
271 |
className: thisCol |
433 |
className: thisCol, |
|
|
434 |
defaultContent: '' |
272 |
}; |
435 |
}; |
273 |
// We may need to process the data going in this |
436 |
// We may need to process the data going in this |
274 |
// column, so do it if necessary |
437 |
// column, so do it if necessary |
Lines 284-310
Link Here
|
284 |
}); |
447 |
}); |
285 |
|
448 |
|
286 |
// Initialise the datatable |
449 |
// Initialise the datatable |
287 |
$('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, { |
450 |
table = $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, { |
288 |
'aoColumnDefs': [ // Last column shouldn't be sortable or searchable |
451 |
'aoColumnDefs': [ |
289 |
{ |
452 |
{ // Last column shouldn't be sortable or searchable |
290 |
'aTargets': [ 'actions' ], |
453 |
'aTargets': [ 'actions' ], |
291 |
'bSortable': false, |
454 |
'bSortable': false, |
292 |
'bSearchable': false |
455 |
'bSearchable': false |
293 |
}, |
456 |
}, |
|
|
457 |
{ // Hide the two date columns we use just for sorting |
458 |
'aTargets': [ 'placed', 'updated' ], |
459 |
'bVisible': false, |
460 |
'bSearchable': false |
461 |
}, |
462 |
{ // When sorting 'placed', we want to use the |
463 |
// unformatted column |
464 |
'aTargets': [ 'placed_formatted'], |
465 |
'iDataSort': 7 |
466 |
}, |
467 |
{ // When sorting 'updated', we want to use the |
468 |
// unformatted column |
469 |
'aTargets': [ 'updated_formatted'], |
470 |
'iDataSort': 9 |
471 |
} |
294 |
], |
472 |
], |
295 |
'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending |
473 |
'aaSorting': [[ 9, 'desc' ]], // Default sort, updated descending |
296 |
'processing': true, // Display a message when manipulating |
474 |
'processing': true, // Display a message when manipulating |
297 |
'iDisplayLength': 10, // 10 results per page |
475 |
'iDisplayLength': 10, // 10 results per page |
298 |
'sPaginationType': "full_numbers", // Pagination display |
476 |
'sPaginationType': "full_numbers", // Pagination display |
299 |
'deferRender': true, // Improve performance on big datasets |
477 |
'deferRender': true, // Improve performance on big datasets |
300 |
'data': dataCopy, |
478 |
'data': dataCopy, |
301 |
'columns': colData, |
479 |
'columns': colData, |
302 |
'originalData': data // Enable render functions to access |
480 |
'originalData': data, // Enable render functions to access |
303 |
// our original data |
481 |
// our original data |
|
|
482 |
'initComplete': function() { |
483 |
|
484 |
// Prepare any filter elements that need it |
485 |
for (var el in filterable) { |
486 |
if (filterable.hasOwnProperty(el)) { |
487 |
if (filterable[el].hasOwnProperty('prep')) { |
488 |
filterable[el].prep(dataCopy, data); |
489 |
} |
490 |
if (filterable[el].hasOwnProperty('listener')) { |
491 |
filterable[el].listener(); |
492 |
} |
493 |
} |
494 |
} |
495 |
|
496 |
} |
304 |
})); |
497 |
})); |
|
|
498 |
|
305 |
} |
499 |
} |
306 |
); |
500 |
); |
307 |
|
501 |
|
|
|
502 |
var clearSearch = function() { |
503 |
table.search('').columns().search(''); |
504 |
activeFilters = {}; |
505 |
for (var filter in filterable) { |
506 |
if ( |
507 |
filterable.hasOwnProperty(filter) && |
508 |
filterable[filter].hasOwnProperty('clear') |
509 |
) { |
510 |
filterable[filter].clear(); |
511 |
} |
512 |
} |
513 |
table.draw(); |
514 |
}; |
515 |
|
516 |
// Apply any search filters, or clear any previous |
517 |
// ones |
518 |
$('#illfilter_form').submit(function(event) { |
519 |
event.preventDefault(); |
520 |
table.search('').columns().search(''); |
521 |
for (var active in activeFilters) { |
522 |
if (activeFilters.hasOwnProperty(active)) { |
523 |
activeFilters[active](); |
524 |
} |
525 |
} |
526 |
table.draw(); |
527 |
}); |
528 |
|
529 |
// Clear all filters |
530 |
$('#clear_search').click(function() { |
531 |
clearSearch(); |
532 |
}); |
533 |
|
308 |
}); |
534 |
}); |
309 |
//]]> |
535 |
//]]> |
310 |
</script> |
536 |
</script> |
Lines 326-331
Link Here
|
326 |
|
552 |
|
327 |
<div id="doc3" class="yui-t2"> |
553 |
<div id="doc3" class="yui-t2"> |
328 |
<div id="bd"> |
554 |
<div id="bd"> |
|
|
555 |
[% IF query_type == 'illlist' %] |
556 |
<div id="illfilter_yui_column" class="yui-b"> |
557 |
<form method="get" id="illfilter_form"> |
558 |
<fieldset class="brief"> |
559 |
<h3>Filters</h3> |
560 |
<ol> |
561 |
<li> |
562 |
<label for="illfilter_status">Status:</label> |
563 |
<select name="illfilter_status" id="illfilter_status"> |
564 |
<option value=""></option> |
565 |
</select> |
566 |
</li> |
567 |
<li> |
568 |
<label for="illfilter_dateplaced">Date placed:</label> |
569 |
<input type="text" name="illfilter_dateplaced" id="illfilter_dateplaced" class="datepicker"> |
570 |
</li> |
571 |
<li> |
572 |
<label for="illfilter_datemodified">Updated on:</label> |
573 |
<input type="text" name="illfilter_datemodified" id="illfilter_datemodified" class="datepicker"> |
574 |
</li> |
575 |
<li> |
576 |
<label for="illfilter_branchname">Library:</label> |
577 |
<select name="illfilter_branchname" id="illfilter_branchname"> |
578 |
<option value=""></option> |
579 |
</select> |
580 |
</li> |
581 |
<li> |
582 |
<label for="illfilter_barcode">Patron barcode:</label> |
583 |
<input type="text" name="illfilter_barcode" id="illfilter_barcode"> |
584 |
</li> |
585 |
</ol> |
586 |
<fieldset class="action"> |
587 |
<input type="submit" value="Search" /> |
588 |
<input type="button" value="Clear" id="clear_search" /> |
589 |
</fieldset> |
590 |
</fieldset> |
591 |
</form> |
592 |
</div> |
593 |
[% END %] |
329 |
<div id="yui-main"> |
594 |
<div id="yui-main"> |
330 |
<div id="interlibraryloans" class="yui-b"> |
595 |
<div id="interlibraryloans" class="yui-b"> |
331 |
[% IF !backends_available || !has_branch %] |
596 |
[% IF !backends_available || !has_branch %] |
Lines 715-721
Link Here
|
715 |
<th>Bibliographic record ID</th> |
980 |
<th>Bibliographic record ID</th> |
716 |
<th>Library</th> |
981 |
<th>Library</th> |
717 |
<th>Status</th> |
982 |
<th>Status</th> |
718 |
<th>Updated on</th> |
983 |
<th class="placed"> </th> |
|
|
984 |
<th class="placed_formatted">Date placed</th> |
985 |
<th class="updated"> </th> |
986 |
<th class="updated_formatted">Updated on</th> |
719 |
<th>Request number</th> |
987 |
<th>Request number</th> |
720 |
<th>Comments</th> |
988 |
<th>Comments</th> |
721 |
<th class="actions"></th> |
989 |
<th class="actions"></th> |
722 |
- |
|
|