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