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