7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › ILL requests</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% Asset.css("css/datatables.css") | $raw %]
13 <body id="illrequests" class="ill">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
17 <div id="breadcrumbs">
18 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
19 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
20 [% IF query_type == 'create' %]
22 [% ELSIF query_type == 'status' %]
27 <div id="doc3" class="yui-t2">
29 [% IF query_type == 'illlist' %]
30 <div id="illfilter_yui_column" class="yui-b">
31 <form method="get" id="illfilter_form">
32 <fieldset class="brief">
36 <label for="illfilter_status">Status:</label>
37 <select name="illfilter_status" id="illfilter_status">
38 <option value=""></option>
42 <label for="illfilter_dateplaced_start">Date placed between:</label>
43 <input type="text" name="illfilter_dateplaced_start" id="illfilter_dateplaced_start" class="datepicker" />
46 <label for="illfilter_dateplaced_end">and:</label>
47 <input type="text" name="illfilter_dateplaced_end" id="illfilter_dateplaced_end" class="datepicker" />
50 <label for="illfilter_datemodified_start">Updated between:</label>
51 <input type="text" name="illfilter_datemodified_start" id="illfilter_datemodified_start" class="datepicker" />
54 <label for="illfilter_datemodified_end">and:</label>
55 <input type="text" name="illfilter_datemodified_end" id="illfilter_datemodified_end" class="datepicker" />
58 <label for="illfilter_branchname">Library:</label>
59 <select name="illfilter_branchname" id="illfilter_branchname">
60 <option value=""></option>
64 <label for="illfilter_barcode">Patron barcode:</label>
65 <input type="text" name="illfilter_barcode" id="illfilter_barcode" />
68 <fieldset class="action">
69 <input type="submit" value="Search" />
70 <input type="button" value="Clear" id="clear_search" />
77 <div id="interlibraryloans" class="yui-b">
78 [% IF !backends_available || !has_branch %]
79 <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a></div>
81 [% INCLUDE 'ill-toolbar.inc' %]
84 <h1>Error performing operation</h1>
85 <!-- Dispatch on Status -->
86 <p>We encountered an error:</p>
88 <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
92 [% IF query_type == 'create' %]
93 <h1>New ILL request</h1>
94 [% PROCESS $whole.template %]
96 [% ELSIF query_type == 'confirm' %]
97 <h1>Confirm ILL request</h1>
98 [% PROCESS $whole.template %]
100 [% ELSIF query_type == 'cancel' and !whole.error %]
101 <h1>Cancel a confirmed request</h1>
102 [% PROCESS $whole.template %]
104 [% ELSIF query_type == 'generic_confirm' %]
105 <h1>Place request with partner libraries</h1>
107 [% IF error == 'no_target_email' %]
109 No target email addresses found. Either select at least
110 one partner or check your ILL partner library records.
112 [% ELSIF error == 'no_library_email' %]
114 Your library has no usable email address. Please set it.
116 [% ELSIF error == 'unkown_error' %]
118 Unknown error processing your request. Contact your administrator.
122 <!-- Start of GENERIC_EMAIL case -->
123 [% IF whole.value.partners %]
124 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
125 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
126 <fieldset class="rows">
127 <legend>Interlibrary loan request details</legend>
130 <label for="partner_filter">Filter partner libraries:</label>
131 <input type="text" id="partner_filter" />
134 <label for="partners" class="required">Select partner libraries:</label>
135 <select size="5" multiple="true" id="partners" name="partners" required="required">
136 [% FOREACH partner IN whole.value.partners %]
137 <option value=[% partner.email | html %]>
138 [% partner.branchcode _ " - " _ partner.surname %]
145 <label for="subject" class="required">Subject Line</label>
146 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
149 <label for="body" class="required">Email text:</label>
150 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
153 <input type="hidden" value="generic_confirm" name="method">
154 <input type="hidden" value="draft" name="stage">
155 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
157 <fieldset class="action">
158 <input type="submit" class="btn btn-default" value="Send email"/>
159 <span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span>
163 <fieldset class="rows">
164 <legend>Interlibrary loan request details</legend>
165 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
166 <p>Be sure to provide email addresses for these patrons.</p>
167 <p><span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span></p>
170 <!-- generic_confirm ends here -->
172 [% ELSIF query_type == 'edit_action' %]
173 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
174 <fieldset class="rows">
175 <legend>Request details</legend>
177 [% type = request.get_type %]
178 <li class="borrowernumber">
179 <label for="borrowernumber">Patron ID:</label>
180 [% request.borrowernumber | html %]
182 <li class="biblio_id">
183 <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
184 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
186 <li class="branchcode">
187 <label for="library" class="branchcode">Library:</label>
188 <select name="branchcode" id="library">
189 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
193 <label class="status">Status:</label>
194 [% stat = request.status %]
195 [% request.capabilities.$stat.name | html %]
198 <label class="updated">Last updated:</label>
199 [% request.updated | $KohaDates with_hours => 1 %]
202 <label class="medium">Request type:</label>
203 [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
206 <label class="cost">Cost:</label>
207 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
209 <li class="price_paid">
210 <label class="price_paid">Price paid:</label>
211 <input name="price_paid" id="price_paid" type="text" value="[% request.price_paid | html %]">
214 <label class="req_id">Request number:</label>
215 [% request.id_prefix _ request.illrequest_id | html %]
217 <li class="notesstaff">
218 <label for="notesstaff" class="notesstaff">Staff notes:</label>
219 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
221 <li class="notesopac">
222 <label for="notesopac" class="notesopac">Opac notes:</label>
223 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
227 <fieldset class="action">
228 <input type="hidden" value="edit_action" name="method">
229 <input type="hidden" value="form" name="stage">
230 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
231 <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
232 <input type="submit" value="Submit">
233 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]">Cancel</a>
237 [% ELSIF query_type == 'delete_confirm' %]
239 <div class="dialog alert">
240 <h3>Are you sure you wish to delete this request?</h3>
241 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
242 <input type="hidden" name="method" value="delete" />
243 <input type="hidden" name="confirmed" value="1" />
244 <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
245 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
247 <a class="btn btn-default btn-sm deny" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]"><i class="fa fa-fw fa-remove"></i>No, do not delete</a>
250 [% ELSIF query_type == 'illview' %]
251 [% req_status = request.status %]
254 [% IF error == 'migrate_target' %]
256 The backend you tried to migrate to does not yet support migrations, please try again with an alternative target.
261 <h1>Manage ILL request</h1>
262 <div id="request-toolbar" class="btn-toolbar">
263 <a title="Edit request" id="ill-toolbar-btn-edit-action" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=edit_action&illrequest_id=[% request.illrequest_id | html %]">
264 <span class="fa fa-pencil"></span>
267 [% FOREACH action IN request.available_actions %]
268 [% IF action.method == 'migrate' %]
269 [% IF backends.size > 2 %]
270 <div class="dropdown btn-group">
271 <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
272 <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
274 <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
275 [% FOREACH backend IN backends %]
276 [% IF backend != request.backend %]
277 <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]&backend=[% backend | uri %]">[% backend | html %]</a></li>
282 [% ELSIF backends.size == 2 %]
283 [% FOREACH backend IN backends %]
284 [% IF backend != request.backend %]
285 <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]&backend=[% backend | uri %]">
286 <span class="fa [% action.ui_method_icon | html %]"></span>
287 [% action.ui_method_name | html %]
292 [% ELSIF action.method != 0 %]
293 <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]">
294 <span class="fa [% action.ui_method_icon | html %]"></span>
295 [% action.ui_method_name | html %]
299 <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-sm btn-default pull-right" href="#">
300 <span class="fa fa-eye"></span>
301 Display supplier metadata
304 <div class="ill-view-panel panel panel-default">
305 <div class="panel-heading">
306 <h3>Request details</h3>
308 <div class="panel-body">
309 <h4>Details from library</h4>
313 <span class="label orderid">Order ID:</span>
314 [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
316 <li class="borrowernumber">
317 <span class="label borrowernumber">Patron:</span>
318 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
319 <a href="[% borrowerlink | url %]" title="View borrower details">
320 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
324 <li class="biblio_id">
325 <span class="label biblio_id">Bibliographic record ID:</span>
326 [% IF request.biblio_id %]
327 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
332 <li class="branchcode">
333 <span class="label branchcode">Library:</span>
334 [% Branches.GetName(request.branchcode) | html %]
337 <span class="label status">Status:</span>
338 [% request.capabilities.$req_status.name | html %]
341 <span class="label updated">Last updated:</span>
342 [% request.updated | $KohaDates with_hours => 1 %]
345 <span class="label medium">Request type:</span>
346 [% type = request.get_type %]
347 [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
350 <span class="label cost">Cost:</span>
351 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
353 <li class="price_paid">
354 <span class="label price_paid">Price paid:</span>
355 [% IF request.price_paid %][% request.price_paid | html %][% ELSE %]<span>N/A</span>[% END %]
358 <span class="label req_id">Request number:</span>
359 [% request.id_prefix _ request.illrequest_id | html %]
361 <li class="notesstaff">
362 <span class="label notes_staff">Staff notes:</span>
363 <p>[% request.notesstaff | html %]</p>
365 <li class="notesopac">
366 <span class="label notes_opac">Notes:</span>
367 <p>[% request.notesopac | html %]</p>
372 <h4>Details from supplier ([% request.backend | html %])</h4>
374 [% FOREACH meta IN request.metadata %]
375 <li class="requestmeta-[% meta.key.replace('\s','_') | html %]">
376 <span class="label">[% meta.key | html %]:</span>
377 [% meta.value | html %]
385 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
386 <div class="modal-dialog">
387 <div class="modal-content">
388 <div class="modal-header">
389 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
390 <h3 id="dataPreviewLabel"> Supplier metadata</h3>
392 <div class="modal-body">
393 <div id="requestattributes">
394 [% FOREACH attr IN request.illrequestattributes %]
395 <div class="requestattr-[% attr.type | html %]">
396 <span class="label">[% attr.type | html %]:</span>
397 [% attr.value | html %]
402 <div class="modal-footer">
403 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
409 <div class="ill-view-panel panel panel-default">
410 <div class="panel-heading">
411 <h3>[% request.illcomments.count | html %] comments</h3>
413 <div class="panel-body">
414 [% IF request.illcomments.count && request.illcomments.count > 0 %]
415 [% FOREACH comment IN request.illcomments %]
416 <div class="rows comment_[% comment.patron.categorycode | html %]">
418 <a href="[% borrowerlink | url %]" title="View borrower details">
419 [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
420 [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
421 <p>[% comment.comment | html %]</p>
426 <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
427 <div id="addcomment" class="content_hidden">
428 <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
429 <input type="hidden" value="save_comment" name="method">
430 <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
431 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
432 <fieldset class="rows">
435 <label class="required" for="comment">Comment: </label>
436 <textarea class="required" required="required" cols="80" rows="10" id="comment" name="comment"></textarea>
437 <span class="required">Required</span>
441 <fieldset class="action">
442 <input type="submit" value="Submit">
450 [% ELSIF query_type == 'illlist' %]
452 <h1>View ILL requests</h1>
454 <h3>Details for all requests</h3>
456 <table id="ill-requests">
458 <tr id="illview-header">
462 <th>Bibliographic record ID</th>
465 <th class="placed"> </th>
466 <th class="placed_formatted">Date placed</th>
467 <th class="updated"> </th>
468 <th class="updated_formatted">Updated on</th>
469 <th>Request number</th>
471 <th class="patron_cardnumber">Patron barcode</th>
472 <th class="actions"></th>
475 <tbody id="illview-body">
480 <!-- Custom Backend Action -->
481 [% PROCESS $whole.template %]
490 [% PROCESS backend_jsinclude %]
494 [% MACRO jsinclude BLOCK %]
495 [% INCLUDE 'datatables.inc' %]
496 [% INCLUDE 'calendar.inc' %]
497 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
499 $(document).ready(function() {
501 // Illview Datatable setup
505 // Filters that are active
506 var activeFilters = {};
508 // Fields we don't want to display
522 // Fields we need to expand (flatten)
529 // This is auto populated
532 // The core fields that should be displayed first
550 // Filterable columns
553 prep: function(tableData, oData) {
555 tableData.forEach(function(row) {
556 var resolvedName = getStatusName(
557 oData[0].capabilities[row.status].name
559 uniques[resolvedName] = 1
561 Object.keys(uniques).sort().forEach(function(unique) {
562 $('#illfilter_status').append(
563 '<option value="' + unique +
564 '">' + unique + '</option>'
568 listener: function() {
570 $('#illfilter_status').change(function() {
571 var sel = $('#illfilter_status option:selected').val();
572 if (sel && sel.length > 0) {
573 activeFilters[me] = function() {
574 table.column(5).search(sel);
577 if (activeFilters.hasOwnProperty(me)) {
578 delete activeFilters[me];
584 $('#illfilter_status').val('');
588 prep: function(tableData, oData) {
590 tableData.forEach(function(row) {
591 uniques[row.library.branchname] = 1
593 Object.keys(uniques).sort().forEach(function(unique) {
594 $('#illfilter_branchname').append(
595 '<option value="' + unique +
596 '">' + unique + '</option>'
600 listener: function() {
601 var me = 'pickupBranch';
602 $('#illfilter_branchname').change(function() {
603 var sel = $('#illfilter_branchname option:selected').val();
604 if (sel && sel.length > 0) {
605 activeFilters[me] = function() {
606 table.column(4).search(sel);
609 if (activeFilters.hasOwnProperty(me)) {
610 delete activeFilters[me];
616 $('#illfilter_branchname').val('');
620 listener: function() {
622 $('#illfilter_barcode').change(function() {
623 var val = $('#illfilter_barcode').val();
624 if (val && val.length > 0) {
625 activeFilters[me] = function() {
626 table.column(12).search(val);
629 if (activeFilters.hasOwnProperty(me)) {
630 delete activeFilters[me];
636 $('#illfilter_barcode').val('');
641 $('#illfilter_datemodified_start, #illfilter_datemodified_end').val('');
646 $('#illfilter_dateplaced_start, #illfilter_dateplaced_end').val('');
651 // Remove any fields we're ignoring
652 var removeIgnore = function(dataObj) {
653 dataObj.forEach(function(thisRow) {
654 ignore.forEach(function(thisIgnore) {
655 if (thisRow.hasOwnProperty(thisIgnore)) {
656 delete thisRow[thisIgnore];
662 // Expand any fields we're expanding
663 var expandExpand = function(row) {
664 expand.forEach(function(thisExpand) {
665 if (row.hasOwnProperty(thisExpand)) {
666 if (!expanded.hasOwnProperty(thisExpand)) {
667 expanded[thisExpand] = [];
669 var expandObj = row[thisExpand];
670 Object.keys(expandObj).forEach(
671 function(thisExpandCol) {
672 var expColName = thisExpand + '_' + thisExpandCol;
673 // Keep a list of fields that have been expanded
674 // so we can create toggle links for them
675 if (expanded[thisExpand].indexOf(expColName) == -1) {
676 expanded[thisExpand].push(expColName);
678 expandObj[expColName] =
679 expandObj[thisExpandCol];
680 delete expandObj[thisExpandCol];
683 $.extend(true, row, expandObj);
684 delete row[thisExpand];
689 // Build a de-duped list of all column names
691 core.map(function(thisCore) {
692 allCols[thisCore] = 1;
695 // Strip the expand prefix if it exists, we do this for display
696 var stripPrefix = function(value) {
697 expand.forEach(function(thisExpand) {
698 var regex = new RegExp(thisExpand + '_', 'g');
699 value = value.replace(regex, '');
704 // Our 'render' function for borrowerlink
705 var createPatronLink = function(data, type, row) {
706 return '<a title="' + _("View borrower details") + '" ' +
707 'href="/cgi-bin/koha/members/moremember.pl?' +
708 'borrowernumber='+row.borrowernumber+'">' +
709 row.patron_firstname + ' ' + row.patron_surname +
713 // Our 'render' function for the library name
714 var createLibrary = function(data, type, row) {
715 return row.library.branchname;
718 // Render function for request ID
719 var createRequestId = function(data, type, row) {
720 return row.id_prefix + row.illrequest_id;
723 // Render function for request status
724 var createStatus = function(data, type, row, meta) {
725 var origData = meta.settings.oInit.originalData;
726 if (origData.length > 0) {
727 var status_name = meta.settings.oInit.originalData[0].capabilities[
730 return getStatusName(status_name);
736 var getStatusName = function(origName) {
739 return _("New request");
741 return _("Requested");
742 case "Requested from partners":
743 return _("Requested from partners");
744 case "Request reverted":
745 return _("Request reverted");
746 case "Queued request":
747 return _("Queued request");
748 case "Cancellation requested":
749 return _("Cancellation requested");
751 return _("Completed");
752 case "Delete request":
753 return _("Delete request");
759 // Render function for creating a row's action link
760 var createActionLink = function(data, type, row) {
761 return '<a class="btn btn-default btn-sm" ' +
762 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
763 'method=illview&illrequest_id=' +
765 '">' + _("Manage request") + '</a>';
768 // Columns that require special treatment
772 func: createActionLink
776 func: createPatronLink
779 name: _("Request number"),
780 func: createRequestId
794 name: _("Updated on"),
797 name: _("Patron barcode")
801 // Toggle request attributes in Illview
802 $('#toggle_requestattributes').on('click', function(e) {
804 $('#requestattributes').toggleClass('content_hidden');
807 // Toggle new comment form in Illview
808 $('#toggle_addcomment').on('click', function(e) {
810 $('#addcomment').toggleClass('content_hidden');
813 // Filter partner list
814 $('#partner_filter').keyup(function() {
815 var needle = $('#partner_filter').val();
816 $('#partners > option').each(function() {
817 var regex = new RegExp(needle, 'i');
819 needle.length == 0 ||
820 $(this).is(':selected') ||
821 $(this).text().match(regex)
830 // Display the modal containing request supplier metadata
831 $('#ill-request-display-metadata').on('click', function(e) {
833 $('#dataPreview').modal({show:true});
836 // Get our data from the API and process it prior to passing
839 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
841 var data = JSON.parse(ajax.responseText);
842 // Make a copy, we'll be removing columns next and need
843 // to be able to refer to data that has been removed
844 var dataCopy = $.extend(true, [], data);
845 // Remove all columns we're not interested in
846 removeIgnore(dataCopy);
847 // Expand columns that need it and create an array
848 // of all column names
849 $.each(dataCopy, function(k, row) {
853 // Assemble an array of column definitions for passing
856 Object.keys(allCols).forEach(function(thisCol) {
857 // Create the base column object
863 // We may need to process the data going in this
864 // column, so do it if necessary
866 specialCols.hasOwnProperty(thisCol) &&
867 specialCols[thisCol].hasOwnProperty('func')
869 colObj.render = specialCols[thisCol].func;
871 colObj.data = thisCol;
873 colData.push(colObj);
876 // Initialise the datatable
877 table = $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
879 { // Last column shouldn't be sortable or searchable
880 'aTargets': [ 'actions' ],
884 { // Hide the two date columns we use just for sorting
885 'aTargets': [ 'placed', 'updated' ],
889 { // When sorting 'placed', we want to use the
890 // unformatted column
891 'aTargets': [ 'placed_formatted'],
894 { // When sorting 'updated', we want to use the
895 // unformatted column
896 'aTargets': [ 'updated_formatted'],
900 'aTargets': [ 'patron_cardnumber' ],
905 'aaSorting': [[ 9, 'desc' ]], // Default sort, updated descending
906 'processing': true, // Display a message when manipulating
907 'sPaginationType': "full_numbers", // Pagination display
908 'deferRender': true, // Improve performance on big datasets
911 'originalData': data, // Enable render functions to access
913 'initComplete': function() {
915 // Prepare any filter elements that need it
916 for (var el in filterable) {
917 if (filterable.hasOwnProperty(el)) {
918 if (filterable[el].hasOwnProperty('prep')) {
919 filterable[el].prep(dataCopy, data);
921 if (filterable[el].hasOwnProperty('listener')) {
922 filterable[el].listener();
930 // Custom date range filtering
931 $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
932 var placedStart = $('#illfilter_dateplaced_start').datepicker('getDate');
933 var placedEnd = $('#illfilter_dateplaced_end').datepicker('getDate');
934 var modifiedStart = $('#illfilter_datemodified_start').datepicker('getDate');
935 var modifiedEnd = $('#illfilter_datemodified_end').datepicker('getDate');
936 var rowPlaced = data[6] ? new Date(data[6]) : null;
937 var rowModified = data[8] ? new Date(data[8]) : null;
938 var placedPassed = true;
939 var modifiedPassed = true;
940 if (placedStart && rowPlaced && rowPlaced < placedStart) {
943 if (placedEnd && rowPlaced && rowPlaced > placedEnd) {
944 placedPassed = false;
946 if (modifiedStart && rowModified && rowModified < modifiedStart) {
947 modifiedPassed = false
949 if (modifiedEnd && rowModified && rowModified > modifiedEnd) {
950 modifiedPassed = false;
953 return placedPassed && modifiedPassed;
960 var clearSearch = function() {
961 table.search('').columns().search('');
963 for (var filter in filterable) {
965 filterable.hasOwnProperty(filter) &&
966 filterable[filter].hasOwnProperty('clear')
968 filterable[filter].clear();
974 // Apply any search filters, or clear any previous
976 $('#illfilter_form').submit(function(event) {
977 event.preventDefault();
978 table.search('').columns().search('');
979 for (var active in activeFilters) {
980 if (activeFilters.hasOwnProperty(active)) {
981 activeFilters[active]();
988 $('#clear_search').click(function() {
996 [% INCLUDE 'intranet-bottom.inc' %]