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