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