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