Bug 30952: Staff interface redesign (header)
[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"><i class="fa fa-home"></i></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" 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 issued as it has no biblio 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 branch</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" 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                                     [% 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 number:</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="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
471                             <input type="submit" value="Submit">
472                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Cancel</a>
473                         </fieldset>
474                     </form>
475
476                 [% ELSIF query_type == 'delete_confirm' %]
477
478                     <div class="dialog alert">
479                         <h3>Are you sure you wish to delete this request?</h3>
480                         <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
481                             <input type="hidden" name="method" value="delete" />
482                             <input type="hidden" name="confirmed" value="1" />
483                             <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
484                             <button type="submit" class="btn btn-default approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
485                         </form>
486                         <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>
487                     </div>
488
489                 [% ELSIF query_type == 'illview' %]
490                     [% IF whole.template.length > 0 %]
491                     [% PROCESS $whole.template %]
492                     [% END %]
493                     [% req_status = request.status %]
494
495                     [% IF error %]
496                       [% IF error == 'migrate_target' %]
497                           <div class="alert">
498                               The backend you tried to migrate to does not yet support migrations, please try again with an alternative target.
499                           </div>
500                       [% END %]
501                     [% END %]
502
503                     [% IF tran_success %]
504                         [% succ_methods = [] %]
505                         [% IF tran_success.match('email') %]
506                             [% succ_methods.push('email') %]
507                         [% END %]
508                         [% IF tran_success.match('sms') %]
509                             [% succ_methods.push('SMS') %]
510                         [% END %]
511                         <div class="alert">
512                             The requested notice was queued for delivery by [% succ_methods.join(', ') | html %]
513                         </div>
514                     [% END %]
515                     [% IF tran_fail %]
516                         [% fail_methods = [] %]
517                         [% IF tran_fail.match('email') %]
518                             [% fail_methods.push('email') %]
519                         [% END %]
520                         [% IF tran_fail.match('sms') %]
521                             [% fail_methods.push('SMS') %]
522                         [% END %]
523                         <div class="alert">
524                             The requested notice was NOT queued for delivery by [% fail_methods.join(', ') | html %]
525                         </div>
526                     [% END %]
527
528                     <h1>Manage ILL request</h1>
529                     <div id="request-toolbar" class="btn-toolbar">
530                         <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 %]">
531                         <span class="fa fa-pencil"></span>
532                         Edit request
533                         </a>
534                         [% FOREACH action IN request.available_actions %]
535                             [% needs_prefs = action.needs_prefs.size ? action.needs_prefs : [] %]
536                             [% needs_perms = action.needs_perms.size ? action.needs_perms : [] %]
537                             [% needs_all = action.needs_all.size ? action.needs_all : [] %]
538                             [% has_prefs_count = 0 %]
539                             [% has_perms_count = 0 %]
540                             [% has_all_count = 0 %]
541                             [% FOREACH pref IN needs_prefs %]
542                                 [% IF Koha.Preference(pref) %]
543                                     [% has_prefs_count = has_prefs_count + 1 %]
544                                 [% END %]
545                             [% END %]
546                             [% FOREACH perm IN needs_perms %]
547                                 [% perm_name = 'CAN_' _ perm %]
548                                 [% IF ($perm_name) %]
549                                     [% has_perms_count = has_perms_count + 1 %]
550                                 [% END %]
551                             [% END %]
552                             [% FOREACH func IN needs_all %]
553                                 [% IF func(request) %]
554                                     [% has_all_count = has_all_count + 1 %]
555                                 [% END %]
556                             [% END %]
557                             [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
558                             [% IF action.method == 'migrate' %]
559                                 [% IF backends.size > 2 %]
560                                     <div class="dropdown btn-group">
561                                         <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
562                                             <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
563                                         </button>
564                                         <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
565                                             [% FOREACH backend IN backends %]
566                                                 [% IF backend != request.backend %]
567                                                     <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>
568                                                 [% END %]
569                                             [% END %]
570                                         </ul>
571                                     </div>
572                                 [% ELSIF backends.size == 2 %]
573                                     [% FOREACH backend IN backends %]
574                                         [% IF backend != request.backend %]
575                                             <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 %]">
576                                             <span class="fa [% action.ui_method_icon | html %]"></span>
577                                             [% action.ui_method_name | html %]
578                                             </a>
579                                         [% END %]
580                                     [% END %]
581                                 [% END %]
582                             [% ELSIF action.method != 0 %]
583                                 <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 %]">
584                                 <span class="fa [% action.ui_method_icon | html %]"></span>
585                                 [% action.ui_method_name | html %]
586                                 </a>
587                             [% END %]
588                         [% END %]
589                         <div class="dropdown btn-group">
590                             <button class="btn btn-default dropdown-toggle" type="button" id="ill-notice-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
591                                 <i class="fa fa-envelope"></i> Send notice to patron <span class="caret"></span>
592                             </button>
593                             <ul class="dropdown-menu" aria-labelledby="ill-notice-dropdown">
594                                 [% FOREACH notice IN notices %]
595                                     <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>
596                                 [% END %]
597                             </ul>
598                         </div>
599                         <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-default pull-right" href="#">
600                             <span class="fa fa-eye"></span>
601                             Display supplier metadata
602                         </a>
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                     </div>
608                     <div class="ill-view-panel panel panel-default">
609                         <div class="panel-heading">
610                             <h3>Request details</h3>
611                         </div>
612                         <div class="panel-body">
613                             <h4>Details from library</h4>
614                             <div class="rows">
615                                 <ol>
616                                     <li class="orderid">
617                                         <span class="label orderid">Order ID:</span>
618                                         [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
619                                     </li>
620                                     <li class="borrowernumber">
621                                         <span class="label borrowernumber">Patron:</span>
622                                         [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
623                                         <a href="[% borrowerlink | url %]" title="View borrower details">
624                                         [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
625                                         </a>
626                                     </li>
627
628                                     <li class="biblio_id">
629                                         <span class="label biblio_id">Bibliographic record ID:</span>
630                                         [% IF request.biblio_id %]
631                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
632                                         [% ELSE %]
633                                             <span>N/A</span>
634                                         [% END %]
635                                     </li>
636                                     <li class="branchcode">
637                                         <span class="label branchcode">Library:</span>
638                                         [% Branches.GetName(request.branchcode) | html %]
639                                     </li>
640                                     <li class="status">
641                                         <span class="label status">Status:</span>
642                                         [% IF request.statusalias %]
643                                             [% request.statusalias.lib | html %]
644                                         [% ELSE %]
645                                             [% request.capabilities.$req_status.name | html%]
646                                             [% IF request.requested_partners.length > 0 %]
647                                                 ([% request.requested_partners | html %])
648                                             [% END %]
649                                         [% END %]
650                                     </li>
651                                     <li class="updated">
652                                         <span class="label updated">Last updated:</span>
653                                         [% request.updated | $KohaDates  with_hours => 1 %]
654                                     </li>
655                                     <li class="medium">
656                                         <span class="label medium">Request type:</span>
657                                         [% type = request.get_type %]
658                                         [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
659                                     </li>
660                                     <li class="cost">
661                                         <span class="label cost">Cost:</span>
662                                         [% IF request.cost %][% request.cost | $Price %][% ELSE %]<span>N/A</span>[% END %]
663                                     </li>
664                                     <li class="price_paid">
665                                         <span class="label price_paid">Price paid:</span>
666                                         [% IF request.price_paid %][% request.price_paid | $Price %][% ELSE %]<span>N/A</span>[% END %]
667                                     </li>
668                                     <li class="req_id">
669                                         <span class="label req_id">Request number:</span>
670                                         [% request.id_prefix _ request.illrequest_id | html %]
671                                     </li>
672                                     <li class="notesstaff">
673                                         <span class="label notes_staff">Staff notes:</span>
674                                         <p>[% request.notesstaff | html %]</p>
675                                     </li>
676                                     <li class="notesopac">
677                                         <span class="label notes_opac">Notes:</span>
678                                         <p>[% request.notesopac | html %]</p>
679                                     </li>
680                                 </ol>
681                             </div>
682                             <div class="rows">
683                                 <h4>Details from supplier ([% request.backend | html %])</h4>
684                                 <ol>
685                                     [% FOREACH meta IN request.metadata %]
686                                         <li class="requestmeta-[% meta.key.replace('\s','_') | html %]">
687                                             <span class="label">[% meta.key | html %]:</span>
688                                             [% meta.value | html %]
689                                         </li>
690                                     [% END %]
691                                 </ol>
692                             </div>
693                         </div>
694                     </div>
695
696                     <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
697                         <div class="modal-dialog">
698                             <div class="modal-content">
699                                 <div class="modal-header">
700                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
701                                     <h3 id="dataPreviewLabel"> Supplier metadata</h3>
702                                 </div>
703                                 <div class="modal-body">
704                                     <div id="requestattributes">
705                                         [% FOREACH attr IN request.illrequestattributes %]
706                                         <div class="requestattr-[% attr.type | html %]">
707                                             <span class="label">[% attr.type | html %]:</span>
708                                             [% attr.value | html %]
709                                         </div>
710                                             [% END %]
711                                     </div>
712                                 </div>
713                                 <div class="modal-footer">
714                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
715                                 </div>
716                             </div>
717                         </div>
718                     </div>
719
720                     <div id="requestLog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
721                         <div class="modal-dialog">
722                             <div class="modal-content">
723                                 <div class="modal-header">
724                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
725                                     <h3 id="requestLogLabel"> Request log</h3>
726                                 </div>
727                                 <div class="modal-body">
728                                 [% IF request.logs.size > 0 %]
729                                     [% FOREACH log IN request.logs %]
730                                         [% tpl = log.template %]
731                                         [% INCLUDE $tpl log=log %]
732                                     [% END %]
733                                 [% ELSE %]
734                                     <span>There are no recorded logs for this request</span>
735                                 [% END %]
736                                 </div>
737                                 <div class="modal-footer">
738                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
739                                 </div>
740                             </div>
741                         </div>
742                     </div>
743
744                     <div class="ill-view-panel panel panel-default">
745                         <div class="panel-heading">
746                             <h3>[% request.illcomments.count | html %] comments</h3>
747                         </div>
748                         <div class="panel-body">
749                             [% IF request.illcomments.count && request.illcomments.count > 0 %]
750                                 [% FOREACH comment IN request.illcomments %]
751                                     <div class="rows comment_[% comment.patron.categorycode | html %]">
752                                     <h5>Comment by:
753                                     <a href="[% borrowerlink | url %]" title="View borrower details">
754                                     [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
755                                     [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
756                                     <p>[% comment.comment | html %]</p>
757                                     </div>
758                                 [% END %]
759                             [% END %]
760                                 <div class="rows">
761                                     <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
762                                     <div id="addcomment" class="content_hidden">
763                                         <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
764                                             <input type="hidden" value="save_comment" name="method">
765                                             <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
766                                             <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
767                                             <fieldset class="rows">
768                                                 <ol>
769                                                     <li>
770                                                         <label class="required" for="comment">Comment: </label>
771                                                         <textarea class="required" required="required" cols="80" rows="10" id="comment" name="comment"></textarea>
772                                                         <span class="required">Required</span>
773                                                     </li>
774                                                 </ol>
775                                             </fieldset>
776                                             <fieldset class="action">
777                                                 <input type="submit" value="Submit">
778                                             </fieldset>
779                                         </form>
780                                     </div>
781                                 </div>
782                         </div>
783                     </div>
784
785                 [% ELSIF query_type == 'illlist' %]
786                     <!-- illlist -->
787                     <h1>View ILL requests</h1>
788                     <div id="results">
789                         <h3>Details for all requests</h3>
790                         [% INCLUDE 'ill-list-table.inc' %]
791
792                     </div> <!-- /#results -->
793                 [% ELSIF query_type == 'availability' %]
794                     <!-- availability -->
795                     <h1>Availability</h1>
796                     <div id="results">
797                         <h3>Displaying availability results</h3>
798                         <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
799                             [% FOREACH key IN whole.keys %]
800                                 [% value = whole.$key %]
801                                 [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %]
802                                 <input type="hidden" name="[% key | html %]" value="[% value | html %]">
803                                 [% END %]
804                             [% END %]
805                             [% custom_keys = whole.custom_key.split('\0') %]
806                             [% custom_values = whole.custom_value.split('\0') %]
807                             [% i = 0 %]
808                             [% FOREACH custom_key IN custom_keys %]
809                                 <input type="hidden" name="custom_key" value="[% custom_key | html %]">
810                                 <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
811                             [% i = i + 1 %]
812                             [% END %]
813                             <input type="hidden" name="method" value="create">
814                             <input type="hidden" name="stage" value="form">
815                             <input type="hidden" name="checked_availability" value="1">
816                             <div id="continue-request-row" class="alert">
817                                 If you can't find what you are looking for, you can
818                                 <button class="button" type="submit">continue creating your request</button> or
819                                 <a href="/cgi-bin/koha/ill/ill-requests.pl">cancel your request</a>
820                             </div>
821                         </form>
822                         [% FOR service IN services %]
823                             <h4 class="ill_availability_sourcename">[% service.name | html %]</h4>
824                             [% INCLUDE 'ill-availability-table.inc' service=service %]
825                         [% END %]
826                     </div>
827                 [% ELSE %]
828                 <!-- Custom Backend Action -->
829                 [% PROCESS $whole.template %]
830
831                 [% END %]
832         [% END %]
833                 </div> <!-- /#interlibraryloans -->
834             </main>
835         </div> <!-- /.col-sm-10 -->
836     </div> <!-- /.row -->
837
838
839 [% MACRO jsinclude BLOCK %]
840     [% INCLUDE 'datatables.inc' %]
841     [% INCLUDE 'columns_settings.inc' %]
842     [% INCLUDE 'calendar.inc' %]
843     [% INCLUDE 'select2.inc' %]
844     <script>
845         var prefilters = '[% prefilters | $raw %]';
846         // Set column settings
847         var table_settings = [% TablesSettings.GetTableSettings( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) | $raw %];
848
849         [% IF services_json.length > 0 %]
850         var services = [% services_json | $raw %];
851         [% ELSE %]
852         var services = [];
853         [% END %]
854         [% IF metadata.length > 0 %]
855         var metadata = "[% metadata | $raw %]";
856         [% END %]
857     </script>
858     <script>
859         $('#ill_checkout_inhouse_select').on('change', function() {
860             if ($(this).val().length > 0) {
861                 $('.ill_checkout_due_date').hide();
862             } else {
863                 $('.ill_checkout_due_date').show();
864             }
865         });
866     </script>
867     [% INCLUDE 'ill-list-table-strings.inc' %]
868     [% Asset.js("js/ill-list-table.js") | $raw %]
869     [% IF (query_type == 'availability' || query_type == 'generic_confirm') && Koha.Preference('ILLCheckAvailability') %]
870         [% Asset.js("js/ill-availability.js") | $raw %]
871     [% END %]
872     [% IF query_type == 'availability' && Koha.Preference('ILLCheckAvailability') %]
873         <script>
874             $(document).ready(function() {
875                 window.doSearch();
876             });
877         </script>
878     [% END %]
879     [% IF query_type == 'generic_confirm' && Koha.Preference('ILLCheckAvailability') %]
880         [% Asset.js("js/ill-availability-partner.js") | $raw %]
881     [% END %]
882 [% END %]
883
884 [% TRY %]
885 [% PROCESS backend_jsinclude %]
886 [% CATCH %]
887 [% END %]
888
889 [% INCLUDE 'intranet-bottom.inc' %]