Bug 25614: Move ILL request keyword filter to sidebar
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / ill / ill-requests.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% SET footerjs = 1 %]
7 [% USE AuthorisedValues %]
8 [% USE TablesSettings %]
9 [% USE Price %]
10
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Koha &rsaquo; ILL requests</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 </head>
15
16 <body id="illrequests" class="ill">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'cat-search.inc' %]
19
20 <div id="breadcrumbs">
21     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
22     <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
23     [% IF query_type == 'create' %]
24          &rsaquo; New request
25     [% ELSIF query_type == 'status' %]
26          &rsaquo; Status
27     [% END %]
28 </div>
29
30 <div class="main container-fluid">
31     <div class="row">
32
33         [% IF query_type == 'illlist' %]
34             <div class="col-sm-2">
35                 <aside>
36                     <form method="get" id="illfilter_form">
37                         <fieldset class="brief">
38                             <h3>Filters</h3>
39                             <ol>
40                                 <li>
41                                     <label for="illfilter_keyword">Keyword:</label>
42                                     <input type="text" name="illfilter_keyword" id="illfilter_keyword" />
43                                 </li>
44                                 <li>
45                                     <label for="illfilter_status">Status:</label>
46                                     <select name="illfilter_status" id="illfilter_status">
47                                         <option value=""></option>
48                                     </select>
49                                 </li>
50                                 <li>
51                                     <label for="illfilter_dateplaced_start">Date placed between:</label>
52                                     <input type="text" name="illfilter_dateplaced_start" id="illfilter_dateplaced_start" class="datepicker" />
53                                 </li>
54                                 <li>
55                                     <label for="illfilter_dateplaced_end">and:</label>
56                                     <input type="text" name="illfilter_dateplaced_end" id="illfilter_dateplaced_end" class="datepicker" />
57                                 </li>
58                                 <li>
59                                     <label for="illfilter_datemodified_start">Updated between:</label>
60                                     <input type="text" name="illfilter_datemodified_start" id="illfilter_datemodified_start" class="datepicker" />
61                                 </li>
62                                 <li>
63                                     <label for="illfilter_datemodified_end">and:</label>
64                                     <input type="text" name="illfilter_datemodified_end" id="illfilter_datemodified_end" class="datepicker" />
65                                 </li>
66                                 <li>
67                                     <label for="illfilter_branchname">Library:</label>
68                                     <select name="illfilter_branchname" id="illfilter_branchname">
69                                         <option value=""></option>
70                                     </select>
71                                 </li>
72                                 <li>
73                                     <label for="illfilter_patron">Patron:</label>
74                                     <input type="text" name="illfilter_patron" id="illfilter_patron" />
75                                 </li>
76                             </ol>
77                             <fieldset class="action">
78                                 <input type="submit" value="Search" />
79                                 <input type="button" value="Clear" id="clear_search" />
80                             </fieldset>
81                         </fieldset>
82                     </form> <!-- /#illfilter_form -->
83                 </aside>
84             </div> <!-- /.col-sm-2 -->
85             <div class="col-sm-10">
86                 <main>
87         [% ELSE %]
88             <div class="col-sm-10 col-sm-offset-2">
89                 <main>
90         [% END %]
91             <div id="interlibraryloans">
92         [% IF !backends_available || !has_branch %]
93             <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>
94         [% ELSE %]
95                 [% INCLUDE 'ill-toolbar.inc' %]
96
97                 [% IF whole.error %]
98                     <h1>Error performing operation</h1>
99                     <!-- Dispatch on Status -->
100                     <p>We encountered an error:</p>
101                     <p>
102                       <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
103                     </p>
104                 [% END %]
105
106                 [% IF whole.success %]
107                     <p>[% whole.success | html %]</p>
108                 [% END %]
109
110                 [% IF query_type == 'create' %]
111                     <h1>New ILL request</h1>
112                     [% PROCESS $whole.template %]
113
114                 [% ELSIF query_type == 'confirm' %]
115                     <h1>Confirm ILL request</h1>
116                     [% PROCESS $whole.template %]
117
118                 [% ELSIF query_type == 'cancel' and !whole.error %]
119                     <h1>Cancel a confirmed request</h1>
120                     [% PROCESS $whole.template %]
121
122                 [% ELSIF query_type == 'check_out' and !whole.error %]
123                     [% IF !whole.stage || whole.stage == 'form' %]
124                         <h1 id="ill-issue-title">Issue requested item to [% INCLUDE 'patron-title.inc' patron = request.patron %]</h1>
125                         [% IF !request.biblio_id || request.biblio_id.length == 0 %]
126                         <div class="alert">This item cannot be issued as it has no biblio record associated with it</div>
127                         [% END %]
128                         [% IF whole.value.errors.itemcount %]
129                         <div class="alert">The bibliographic record for this request has multiple items, it should only have one. Please fix this then try again.</div>
130                         [% END %]
131                         [% IF whole.value.errors.item_creation %]
132                         <div class="alert">An unknown error occurred while trying to add an item</div>
133                         [% END %]
134                         [% IF whole.value.errors.item_check_out %]
135                         <div class="alert">An unknown error occurred while trying to check out the item</div>
136                         [% END %]
137                         [% IF whole.value.check_out_errors %]
138                             [% IF whole.value.check_out_errors.error.STATS %]
139                             <div class="alert">
140                                 Local use recorded
141                             </div>
142                             [% ELSE %]
143                             <div class="alert">
144                                 There was a problem checking this item out, please check for problems with the <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% whole.value.patron.borrowernumber | uri %]">patron's account</a>
145                             </div>
146                             [% END %]
147                         [% END %]
148                         [% IF request.biblio_id && request.biblio_id.length > 0  && !whole.value.check_out_errors.error.STATS %]
149                             <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
150                                 <fieldset class="rows">
151                                     <legend>Check out details</legend>
152                                     [% items = whole.value.biblio.items.unblessed %]
153                                     [% IF items.size == 1 %]
154                                         <p>The bibliographic record for this request already has an item attached to it, you are about to check it out</p>
155                                     [% ELSE %]
156                                         <p>A bibliographic record for this request exists, but no item. You are about to create an item and check it out</p>
157                                     [% END %]
158                                     <ol>
159                                         <li class="ill_checkout_inhouse">
160                                             <label for="inhouse" class="ill_checkout_inhouse_label">Statistical patron:</label>
161                                             <select id="ill_checkout_inhouse_select" name="inhouse" class="ill_checkout_inhouse_select">
162                                                 <option value=""></option>
163                                                 [% FOREACH stat IN whole.value.statistical %]
164                                                     [% IF stat.borrowernumber == params.inhouse %]
165                                                         <option value="[% stat.cardnumber | html %]" selected>[% INCLUDE 'patron-title.inc' patron = stat %]</option>
166                                                     [% ELSE %]
167                                                         <option value="[% stat.cardnumber | html %]">[% INCLUDE 'patron-title.inc' patron = stat %]</option>
168                                                     [% END %]
169                                                 [% END %]
170                                             </select>
171                                             [% IF whole.value.errors.inhouse %]
172                                             <span class="required">You must choose a valid patron</span>
173                                             [% END %]
174                                             <div class="hint">If you do not wish to check out the item to [% INCLUDE 'patron-title.inc' patron = request.patron %] and would rather issue it to an in-house statistical patron, choose the patron here</div>
175                                         </li>
176                                         <li class="ill_checkout_item_type">
177                                             <label for="item_type" class="ill_checkout_item_type_label required">Item type:</label>
178                                             [% IF items.size != 1 %]
179                                                 <select id="ill_checkout_item_type_select" name="item_type" required>
180                                                     [% FOREACH type IN whole.value.itemtypes %]
181                                                         [% IF type.itemtype == params.item_type %]
182                                                         <option value="[% type.itemtype | html %]" selected>
183                                                         [% ELSE %]
184                                                         <option value="[% type.itemtype | html %]">
185                                                         [% END %]
186                                                             [% type.description | html %]
187                                                         </option>
188                                                     [% END %]
189                                                 </select>
190                                             [% ELSE %]
191                                                 [% FOREACH type IN whole.value.itemtypes %]
192                                                     [% IF type.itemtype == items.0.itype %]
193                                                         [% type.description | html %]
194                                                     [% END %]
195                                                 [% END %]
196                                             [% END %]
197                                             [% IF whole.value.errors.item_type %]
198                                             <span class="required">You must choose an item type</span>
199                                             [% END %]
200                                         </li>
201                                         [% IF items.size == 1 %]
202                                             <li>
203                                                 <label for="barcode" class="ill_checkout_barcode_label">Item barcode:</label>
204                                                 [% items.0.barcode | html %]
205                                             </li>
206                                         [% END %]
207                                         <li class="ill_checkout_branchcode">
208                                             <label for="branchcode" class="ill_checkout_branchcode_label required">Library:</label>
209                                             [% branchcode = items.size == 1 ? items.0.homebranch : params.branchcode ? params.branchcode : request.branchcode %]
210                                             [% IF items.size != 1 %]
211                                                 <select name="branchcode" id="ill_checkout_branchcode_select" required>
212                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
213                                                 </select>
214                                             [% ELSE %]
215                                                 [% FOREACH branch IN whole.value.libraries.unblessed %]
216                                                     [% IF branch.branchcode == branchcode %]
217                                                         [% branch.branchname | html %]
218                                                     [% END %]
219                                                 [% END %]
220                                             [% END %]
221                                             [% IF whole.value.errors.branchcode %]
222                                             <span class="required">You must choose a branch</span>
223                                             [% END %]
224                                         </li>
225                                         <li class="ill_checkout_due_date">
226                                             <label for="duedate" class="ill_checkout_duedate_label">Due date:</label>
227                                             <input name="duedate" id="ill_checkout_duedate_input" type="text" value="[% params.duedate | html %]"> [% INCLUDE 'date-format.inc' %]
228                                             <div class="hint">If you do not specify a due date, it will be set according to circulation rules</p>
229                                         </li>
230                                     </ol>
231                                 </fieldset>
232                                 <fieldset class="action">
233                                     <input type="hidden" value="check_out" name="method">
234                                     <input type="hidden" value="form" name="stage">
235                                     [% IF items.size == 1 %]
236                                         <input name="branchcode" type="hidden" value="[% branchcode | html %]">
237                                         <input name="item_type" type="hidden" value="[% items.0.itype | html %]">
238                                     [% END %]
239                                     <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
240                                     <input type="submit" value="Submit">
241                                     <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Cancel</a>
242                                 </fieldset>
243                             </form>
244                         [% END %]
245                         [% IF whole.value.check_out_errors.error.STATS %]
246                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Return to request</a>
247                         [% END %]
248                     [% ELSIF whole.stage == 'done_check_out' %]
249                         <h1>Item checked out</h1>
250                         <fieldset class="rows">
251                             <legend>Check out details</legend>
252                             <ol>
253                                 <li>
254                                     <label>Checked out to:</label>
255                                     [% INCLUDE 'patron-title.inc' patron = whole.value.patron %]
256                                 </li>
257                                 <li>
258                                     <label>Due date:</label>
259                                     [% whole.value.check_out.date_due | $KohaDates with_hours => 1 %]
260                                 </li>
261                             </ol>
262                         </fieldset>
263                         <fieldset class="action">
264                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Return to request</a>
265                         </fieldset>
266                     [% END %]
267
268                 [% ELSIF query_type == 'generic_confirm' %]
269                     <h1>Place request with partner libraries</h1>
270                   [% IF error %]
271                     [% IF error == 'no_target_email' %]
272                         <div class="alert">
273                             No target email addresses found. Either select at least
274                             one partner or check your ILL partner library records.
275                         </div>
276                     [% ELSIF error == 'no_library_email' %]
277                         <div class="alert">
278                             Your library has no usable email address. Please set it.
279                         </div>
280                     [% ELSIF error == 'unkown_error' %]
281                         <div class="alert">
282                             Unknown error processing your request. Contact your administrator.
283                         </div>
284                     [% END %]
285                   [% END %]
286                     <!-- Start of GENERIC_EMAIL case -->
287                     [% IF whole.value.partners %]
288                        [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
289                         <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
290                             <fieldset class="rows">
291                                 <legend>Interlibrary loan request details</legend>
292                                 <ol>
293                                     <li>
294                                         <label for="partner_filter">Filter partner libraries:</label>
295                                         <input type="text" id="partner_filter" />
296                                     </li>
297                                     <li>
298                                         <label for="partners" class="required">Select partner libraries:</label>
299                                         <select size="5" multiple="true" id="partners" name="partners" required="required">
300                                             [% FOREACH partner IN whole.value.partners %]
301                                                 [% IF partner.email && partner.email.length > 0 %]
302                                                     <option data-partner-id="[% partner.id | html %]" value=[% partner.email | html %]>
303                                                         [% partner.branchcode _ " - " _ partner.surname %]
304                                                     </option>
305                                                 [% END %]
306                                             [% END %]
307                                         </select>
308                                         [% IF Koha.Preference('ILLCheckAvailability') %]
309                                             <div id="generic_confirm_search_count">Partners available for searching: <span id="generic_confirm_enabled">none</span></div>
310                                             <div id="generic_confirm_search">
311                                                 <button type="button">Search selected partners</button>
312                                             </div>
313                                         [% END %]
314                                     </li>
315                                     <li>
316                                         <label for="subject" class="required">Subject line:</label>
317                                         <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
318                                     </li>
319                                     <li>
320                                         <label for="body" class="required">Email text:</label>
321                                         <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
322                                     </li>
323                                 </ol>
324                                 <input type="hidden" value="generic_confirm" name="method">
325                                 <input type="hidden" value="draft" name="stage">
326                                 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
327                             </fieldset>
328                             <fieldset class="action">
329                                 <input type="submit" class="btn btn-default" value="Send email"/>
330                                 <span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span>
331                             </fieldset>
332                         </form>
333                         [% IF Koha.Preference('ILLCheckAvailability') %]
334                             <div id="partnerSearch" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="partnerSearchLabel" aria-hidden="true">
335                                 <div class="modal-dialog">
336                                     <div class="modal-content">
337                                         <div class="modal-header">
338                                             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
339                                             <h3 id="partnerSearchLabel"> Search partners</h3>
340                                         </div>
341                                         <div class="modal-body">
342                                             [% FOR service IN services %]
343                                                 <h4 class="ill_availability_sourcename">[% service.name | html %]</h4>
344                                                 [% INCLUDE 'ill-availability-table.inc' service=service %]
345                                             [% END %]
346                                             <span id="service_id_restrict" data-service_id_restrict_plugin="ILL availability - z39.50" data-service_id_restrict_ids=""></span>
347                                         </div>
348                                         <div class="modal-footer">
349                                             <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
350                                         </div>
351                                     </div>
352                                 </div>
353                             </div>
354                         [% END %]
355
356                     [% ELSE %]
357                         <fieldset class="rows">
358                             <legend>Interlibrary loan request details</legend>
359                             <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
360                             <p>Be sure to provide email addresses for these patrons.</p>
361                             <p><span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span></p>
362                         </fieldset>
363                     [% END %]
364                 <!-- generic_confirm ends here -->
365
366                 [% ELSIF query_type == 'edit_action' %]
367                     <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
368                         <fieldset class="rows">
369                             <legend>Request details</legend>
370                             <ol>
371                                 [% type = request.get_type %]
372                                 <li class="borrowernumber">
373                                     <label for="borrowernumber">Patron ID:</label>
374                                     [% request.borrowernumber | html %]
375                                 </li>
376                                 <li class="biblio_id">
377                                     <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
378                                     <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
379                                 </li>
380                                 <li class="branchcode">
381                                     <label for="library" class="branchcode">Library:</label>
382                                     <select name="branchcode" id="library">
383                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
384                                     </select>
385                                 </li>
386                                 <li class="status">
387                                     <label class="status">Status:</label>
388                                     [% stat = request.status %]
389                                     [% current_alias = request.status_alias %]
390                                     <select id="status_alias" name="status_alias">
391                                         [% IF !current_alias %]
392                                         <option value="" selected>
393                                         [% ELSE %]
394                                         <option value="">
395                                         [% END %]
396                                             [% request.capabilities.$stat.name | html %]
397                                         </option>
398                                         [% FOREACH alias IN AuthorisedValues.Get('ILLSTATUS') %]
399                                             [% IF alias.authorised_value == current_alias %]
400                                             <option value="[% alias.authorised_value | html %]" selected>
401                                             [% ELSE %]
402                                             <option value="[% alias.authorised_value | html %]">
403                                             [% END %]
404                                                 [% alias.lib | html %]
405                                             </option>
406                                         [% END %]
407                                     </select>
408                                 </li>
409                                 <li class="updated">
410                                     <label class="updated">Last updated:</label>
411                                     [% request.updated | $KohaDates  with_hours => 1 %]
412                                 </li>
413                                 <li class="medium">
414                                     <label class="medium">Request type:</label>
415                                     [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
416                                 </li>
417                                 <li class="cost">
418                                     <label class="cost">Cost:</label>
419                                     [% IF request.cost %][% request.cost | $Price %][% ELSE %]<span>N/A</span>[% END %]
420                                 </li>
421                                 <li class="price_paid">
422                                     <label class="price_paid">Price paid:</label>
423                                     <input name="price_paid" id="price_paid" type="text" value="[% request.price_paid | html %]">
424                                 </li>
425                                 <li class="req_id">
426                                     <label class="req_id">Request number:</label>
427                                     [% request.id_prefix _ request.illrequest_id | html %]
428                                 </li>
429                                 <li class="notesstaff">
430                                     <label for="notesstaff" class="notesstaff">Staff notes:</label>
431                                     <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
432                                 </li>
433                                 <li class="notesopac">
434                                     <label for="notesopac" class="notesopac">Opac notes:</label>
435                                     <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
436                                 </li>
437                             </ol>
438                         </fieldset>
439                         <fieldset class="action">
440                             <input type="hidden" value="edit_action" name="method">
441                             <input type="hidden" value="form" name="stage">
442                             <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
443                             <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
444                             <input type="submit" value="Submit">
445                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Cancel</a>
446                         </fieldset>
447                     </form>
448
449                 [% ELSIF query_type == 'delete_confirm' %]
450
451                     <div class="dialog alert">
452                         <h3>Are you sure you wish to delete this request?</h3>
453                         <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
454                             <input type="hidden" name="method" value="delete" />
455                             <input type="hidden" name="confirmed" value="1" />
456                             <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
457                             <button type="submit" class="btn btn-default approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
458                         </form>
459                         <a class="btn btn-default deny" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]"><i class="fa fa-fw fa-remove"></i>No, do not delete</a>
460                     </div>
461
462                 [% ELSIF query_type == 'illview' %]
463                     [% req_status = request.status %]
464
465                     [% IF error %]
466                       [% IF error == 'migrate_target' %]
467                           <div class="alert">
468                               The backend you tried to migrate to does not yet support migrations, please try again with an alternative target.
469                           </div>
470                       [% END %]
471                     [% END %]
472
473                     [% IF tran_success %]
474                         [% succ_methods = [] %]
475                         [% IF tran_success.match('email') %]
476                             [% succ_methods.push('email') %]
477                         [% END %]
478                         [% IF tran_success.match('sms') %]
479                             [% succ_methods.push('SMS') %]
480                         [% END %]
481                         <div class="alert">
482                             The requested notice was queued for delivery by [% succ_methods.join(', ') | html %]
483                         </div>
484                     [% END %]
485                     [% IF tran_fail %]
486                         [% fail_methods = [] %]
487                         [% IF tran_fail.match('email') %]
488                             [% fail_methods.push('email') %]
489                         [% END %]
490                         [% IF tran_fail.match('sms') %]
491                             [% fail_methods.push('SMS') %]
492                         [% END %]
493                         <div class="alert">
494                             The requested notice was NOT queued for delivery by [% fail_methods.join(', ') | html %]
495                         </div>
496                     [% END %]
497
498                     <h1>Manage ILL request</h1>
499                     <div id="request-toolbar" class="btn-toolbar">
500                         <a title="Edit request" id="ill-toolbar-btn-edit-action" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=edit_action&amp;illrequest_id=[% request.illrequest_id | html %]">
501                         <span class="fa fa-pencil"></span>
502                         Edit request
503                         </a>
504                         [% FOREACH action IN request.available_actions %]
505                             [% needs_prefs = action.needs_prefs.size ? action.needs_prefs : [] %]
506                             [% needs_perms = action.needs_perms.size ? action.needs_perms : [] %]
507                             [% needs_all = action.needs_all.size ? action.needs_all : [] %]
508                             [% has_prefs_count = 0 %]
509                             [% has_perms_count = 0 %]
510                             [% has_all_count = 0 %]
511                             [% FOREACH pref IN needs_prefs %]
512                                 [% IF Koha.Preference(pref) %]
513                                     [% has_prefs_count = has_prefs_count + 1 %]
514                                 [% END %]
515                             [% END %]
516                             [% FOREACH perm IN needs_perms %]
517                                 [% perm_name = 'CAN_' _ perm %]
518                                 [% IF ($perm_name) %]
519                                     [% has_perms_count = has_perms_count + 1 %]
520                                 [% END %]
521                             [% END %]
522                             [% FOREACH func IN needs_all %]
523                                 [% IF func(request) %]
524                                     [% has_all_count = has_all_count + 1 %]
525                                 [% END %]
526                             [% END %]
527                             [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
528                             [% IF action.method == 'migrate' %]
529                                 [% IF backends.size > 2 %]
530                                     <div class="dropdown btn-group">
531                                         <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
532                                             <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
533                                         </button>
534                                         <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
535                                             [% FOREACH backend IN backends %]
536                                                 [% IF backend != request.backend %]
537                                                     <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;backend=[% backend | uri %]">[% backend | html %]</a></li>
538                                                 [% END %]
539                                             [% END %]
540                                         </ul>
541                                     </div>
542                                 [% ELSIF backends.size == 2 %]
543                                     [% FOREACH backend IN backends %]
544                                         [% IF backend != request.backend %]
545                                             <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;backend=[% backend | uri %]">
546                                             <span class="fa [% action.ui_method_icon | html %]"></span>
547                                             [% action.ui_method_name | html %]
548                                             </a>
549                                         [% END %]
550                                     [% END %]
551                                 [% END %]
552                             [% ELSIF action.method != 0 %]
553                                 <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]">
554                                 <span class="fa [% action.ui_method_icon | html %]"></span>
555                                 [% action.ui_method_name | html %]
556                                 </a>
557                             [% END %]
558                         [% END %]
559                         <div class="dropdown btn-group">
560                             <button class="btn btn-default dropdown-toggle" type="button" id="ill-notice-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
561                                 <i class="fa fa-envelope"></i> Send notice to patron <span class="caret"></span>
562                             </button>
563                             <ul class="dropdown-menu" aria-labelledby="ill-notice-dropdown">
564                                 [% FOREACH notice IN notices %]
565                                     <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=send_notice&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;notice_code=[% notice.code | uri %]">[% notice.name | html %]</a></li>
566                                 [% END %]
567                             </ul>
568                         </div>
569                         <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-default pull-right" href="#">
570                             <span class="fa fa-eye"></span>
571                             Display supplier metadata
572                         </a>
573                         <a title="ILL request log" id="ill-request-display-log" class="btn btn-default pull-right" href="#">
574                             <span class="fa fa-calendar"></span>
575                             ILL request log
576                         </a>
577                     </div>
578                     <div class="ill-view-panel panel panel-default">
579                         <div class="panel-heading">
580                             <h3>Request details</h3>
581                         </div>
582                         <div class="panel-body">
583                             <h4>Details from library</h4>
584                             <div class="rows">
585                                 <ol>
586                                     <li class="orderid">
587                                         <span class="label orderid">Order ID:</span>
588                                         [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
589                                     </li>
590                                     <li class="borrowernumber">
591                                         <span class="label borrowernumber">Patron:</span>
592                                         [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
593                                         <a href="[% borrowerlink | url %]" title="View borrower details">
594                                         [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
595                                         </a>
596                                     </li>
597
598                                     <li class="biblio_id">
599                                         <span class="label biblio_id">Bibliographic record ID:</span>
600                                         [% IF request.biblio_id %]
601                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
602                                         [% ELSE %]
603                                             <span>N/A</span>
604                                         [% END %]
605                                     </li>
606                                     <li class="branchcode">
607                                         <span class="label branchcode">Library:</span>
608                                         [% Branches.GetName(request.branchcode) | html %]
609                                     </li>
610                                     <li class="status">
611                                         <span class="label status">Status:</span>
612                                         [% IF request.statusalias %]
613                                             [% request.statusalias.lib | html %]
614                                         [% ELSE %]
615                                             [% request.capabilities.$req_status.name | html%]
616                                             [% IF request.requested_partners.length > 0 %]
617                                                 ([% request.requested_partners | html %])
618                                             [% END %]
619                                         [% END %]
620                                     </li>
621                                     <li class="updated">
622                                         <span class="label updated">Last updated:</span>
623                                         [% request.updated | $KohaDates  with_hours => 1 %]
624                                     </li>
625                                     <li class="medium">
626                                         <span class="label medium">Request type:</span>
627                                         [% type = request.get_type %]
628                                         [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
629                                     </li>
630                                     <li class="cost">
631                                         <span class="label cost">Cost:</span>
632                                         [% IF request.cost %][% request.cost | $Price %][% ELSE %]<span>N/A</span>[% END %]
633                                     </li>
634                                     <li class="price_paid">
635                                         <span class="label price_paid">Price paid:</span>
636                                         [% IF request.price_paid %][% request.price_paid | $Price %][% ELSE %]<span>N/A</span>[% END %]
637                                     </li>
638                                     <li class="req_id">
639                                         <span class="label req_id">Request number:</span>
640                                         [% request.id_prefix _ request.illrequest_id | html %]
641                                     </li>
642                                     <li class="notesstaff">
643                                         <span class="label notes_staff">Staff notes:</span>
644                                         <p>[% request.notesstaff | html %]</p>
645                                     </li>
646                                     <li class="notesopac">
647                                         <span class="label notes_opac">Notes:</span>
648                                         <p>[% request.notesopac | html %]</p>
649                                     </li>
650                                 </ol>
651                             </div>
652                             <div class="rows">
653                                 <h4>Details from supplier ([% request.backend | html %])</h4>
654                                 <ol>
655                                     [% FOREACH meta IN request.metadata %]
656                                         <li class="requestmeta-[% meta.key.replace('\s','_') | html %]">
657                                             <span class="label">[% meta.key | html %]:</span>
658                                             [% meta.value | html %]
659                                         </li>
660                                     [% END %]
661                                 </ol>
662                             </div>
663                         </div>
664                     </div>
665
666                     <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
667                         <div class="modal-dialog">
668                             <div class="modal-content">
669                                 <div class="modal-header">
670                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
671                                     <h3 id="dataPreviewLabel"> Supplier metadata</h3>
672                                 </div>
673                                 <div class="modal-body">
674                                     <div id="requestattributes">
675                                         [% FOREACH attr IN request.illrequestattributes %]
676                                         <div class="requestattr-[% attr.type | html %]">
677                                             <span class="label">[% attr.type | html %]:</span>
678                                             [% attr.value | html %]
679                                         </div>
680                                             [% END %]
681                                     </div>
682                                 </div>
683                                 <div class="modal-footer">
684                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
685                                 </div>
686                             </div>
687                         </div>
688                     </div>
689
690                     <div id="requestLog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
691                         <div class="modal-dialog">
692                             <div class="modal-content">
693                                 <div class="modal-header">
694                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
695                                     <h3 id="requestLogLabel"> Request log</h3>
696                                 </div>
697                                 <div class="modal-body">
698                                 [% IF request.logs.size > 0 %]
699                                     [% FOREACH log IN request.logs %]
700                                         [% tpl = log.template %]
701                                         [% INCLUDE $tpl log=log %]
702                                     [% END %]
703                                 [% ELSE %]
704                                     There are no recorded logs for this request
705                                 [% END %]
706                                 </div>
707                                 <div class="modal-footer">
708                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
709                                 </div>
710                             </div>
711                         </div>
712                     </div>
713
714                     <div class="ill-view-panel panel panel-default">
715                         <div class="panel-heading">
716                             <h3>[% request.illcomments.count | html %] comments</h3>
717                         </div>
718                         <div class="panel-body">
719                             [% IF request.illcomments.count && request.illcomments.count > 0 %]
720                                 [% FOREACH comment IN request.illcomments %]
721                                     <div class="rows comment_[% comment.patron.categorycode | html %]">
722                                     <h5>Comment by:
723                                     <a href="[% borrowerlink | url %]" title="View borrower details">
724                                     [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
725                                     [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
726                                     <p>[% comment.comment | html %]</p>
727                                     </div>
728                                 [% END %]
729                             [% END %]
730                                 <div class="rows">
731                                     <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
732                                     <div id="addcomment" class="content_hidden">
733                                         <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
734                                             <input type="hidden" value="save_comment" name="method">
735                                             <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
736                                             <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
737                                             <fieldset class="rows">
738                                                 <ol>
739                                                     <li>
740                                                         <label class="required" for="comment">Comment: </label>
741                                                         <textarea class="required" required="required" cols="80" rows="10" id="comment" name="comment"></textarea>
742                                                         <span class="required">Required</span>
743                                                     </li>
744                                                 </ol>
745                                             </fieldset>
746                                             <fieldset class="action">
747                                                 <input type="submit" value="Submit">
748                                             </fieldset>
749                                         </form>
750                                     </div>
751                                 </div>
752                         </div>
753                     </div>
754
755                 [% ELSIF query_type == 'illlist' %]
756                     <!-- illlist -->
757                     <h1>View ILL requests</h1>
758                     <div id="results">
759                         <h3>Details for all requests</h3>
760                         [% INCLUDE 'ill-list-table.inc' %]
761
762                     </div> <!-- /#results -->
763                 [% ELSIF query_type == 'availability' %]
764                     <!-- availability -->
765                     <h1>Availability</h1>
766                     <div id="results">
767                         <h3>Displaying availability results</h3>
768                         <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
769                             [% FOREACH key IN whole.keys %]
770                                 [% value = whole.$key %]
771                                 [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %]
772                                 <input type="hidden" name="[% key | html %]" value="[% value | html %]">
773                                 [% END %]
774                             [% END %]
775                             [% custom_keys = whole.custom_key.split('\0') %]
776                             [% custom_values = whole.custom_value.split('\0') %]
777                             [% i = 0 %]
778                             [% FOREACH custom_key IN custom_keys %]
779                                 <input type="hidden" name="custom_key" value="[% custom_key | html %]">
780                                 <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
781                             [% i = i + 1 %]
782                             [% END %]
783                             <input type="hidden" name="method" value="create">
784                             <input type="hidden" name="stage" value="form">
785                             <input type="hidden" name="checked_availability" value="1">
786                             <div id="continue-request-row" class="alert">
787                                 If you can't find what you are looking for, you can
788                                 <button class="button" type="submit">continue creating your request</button> or
789                                 <a href="/cgi-bin/koha/ill/ill-requests.pl">cancel your request</a>
790                             </div>
791                         </form>
792                         [% FOR service IN services %]
793                             <h4 class="ill_availability_sourcename">[% service.name | html %]</h4>
794                             [% INCLUDE 'ill-availability-table.inc' service=service %]
795                         [% END %]
796                     </div>
797                 [% ELSE %]
798                 <!-- Custom Backend Action -->
799                 [% PROCESS $whole.template %]
800
801                 [% END %]
802         [% END %]
803                 </div> <!-- /#interlibraryloans -->
804             </main>
805         </div> <!-- /.col-sm-10 -->
806     </div> <!-- /.row -->
807
808
809 [% MACRO jsinclude BLOCK %]
810     [% INCLUDE 'datatables.inc' %]
811     [% INCLUDE 'columns_settings.inc' %]
812     [% INCLUDE 'calendar.inc' %]
813     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
814     <script>
815         var prefilters = '[% prefilters | $raw %]';
816         // Set column settings
817         var columns_settings = [% TablesSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %];
818         $("#ill_checkout_duedate_input").datetimepicker({
819             hour: 23,
820             minute: 59
821         }).on("change", function(e, value) {
822             if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
823         });
824         [% IF services_json.length > 0 %]
825         var services = [% services_json | $raw %];
826         [% ELSE %]
827         var services = [];
828         [% END %]
829         [% IF metadata.length > 0 %]
830         var metadata = "[% metadata | $raw %]";
831         [% END %]
832     </script>
833     <script>
834         $('#ill_checkout_inhouse_select').on('change', function() {
835             if ($(this).val().length > 0) {
836                 $('.ill_checkout_due_date').hide();
837             } else {
838                 $('.ill_checkout_due_date').show();
839             }
840         });
841     </script>
842     [% INCLUDE 'ill-list-table-strings.inc' %]
843     [% Asset.js("js/ill-list-table.js") | $raw %]
844     [% IF (query_type == 'availability' || query_type == 'generic_confirm') && Koha.Preference('ILLCheckAvailability') %]
845         [% Asset.js("js/ill-availability.js") | $raw %]
846     [% END %]
847     [% IF query_type == 'availability' && Koha.Preference('ILLCheckAvailability') %]
848         <script>
849             $(document).ready(function() {
850                 window.doSearch();
851             });
852         </script>
853     [% END %]
854     [% IF query_type == 'generic_confirm' && Koha.Preference('ILLCheckAvailability') %]
855         [% Asset.js("js/ill-availability-partner.js") | $raw %]
856     [% END %]
857 [% END %]
858
859 [% TRY %]
860 [% PROCESS backend_jsinclude %]
861 [% CATCH %]
862 [% END %]
863
864 [% INCLUDE 'intranet-bottom.inc' %]