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