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