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