Bug 28955: (follow-up) Set to fall back
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-illrequests.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE AdditionalContents %]
6 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Your interlibrary loan requests &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% BLOCK cssinclude %][% END %]
12 </head>
13 [% INCLUDE 'bodytag.inc' bodyid='opac-illrequests' bodyclass='scrollto' %]
14 [% BLOCK messages %]
15     [% IF message == "1" %]
16         <div class="alert alert-success" role="alert">Request updated</div>
17     [% ELSIF message == "2" %]
18         <div class="alert alert-success" role="alert">Request placed</div>
19     [% END %]
20 [% END %]
21 [% INCLUDE 'masthead.inc' %]
22 <div class="main">
23     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
24         <ol class="breadcrumb">
25             <li class="breadcrumb-item">
26                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
27             </li>
28             [% IF ( logged_in_user ) %]
29                 <li class="breadcrumb-item">
30                     <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
31                 </li>
32             [% END %]
33
34             [% IF method != 'list' %]
35                 <li class="breadcrumb-item active">
36                     <a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a>
37                 </li>
38                 [% IF method == 'create' %]
39                     <li class="breadcrumb-item active">
40                         <a href="#" aria-current="page">New interlibrary loan request</a>
41                     </li>
42                 [% ELSIF method == 'view' %]
43                     <li class="breadcrumb-item active">
44                         <a href="#" aria-current="page">View interlibrary loan request</a>
45                     </li>
46                 [% END %]
47             [% ELSE %]
48                 <li class="breadcrumb-item active">
49                     <a href="#" aria-current="page">Interlibrary loan requests</a>
50                 </li>
51             [% END %]
52         </ol> <!-- / .breadcrumb -->
53     </nav> <!-- /#breadcrumbs -->
54
55     <div class="container-fluid">
56         <div class="row">
57             [% IF ( OpacNav||loggedinusername ) && !print %]
58                 <div class="col-lg-2">
59                     <div id="navigation">
60                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
61                     </div>
62                 </div>
63             [% END %]
64
65             [% IF ( OpacNav||loggedinusername ) %]
66                 <div class="col-lg-10 order-first order-md-first order-lg-2">
67             [% ELSE %]
68                 <div class="col order-first order-md-first order-lg-2">
69             [% END %]
70
71                 [% IF !backends_available %]
72                     <div class="alert alert-warning">ILL module configuration problem. Contact your administrator.</div>
73                 [% ELSE %]
74                     <div id="illrequests" class="maincontent">
75                         [% IF method == 'create' %]
76                             <h1>New interlibrary loan request</h1>
77                             [% IF stage == 'copyrightclearance' %]
78                                 [% INCLUDE messages %]
79                                 <div>
80                                     <p>
81                                         [% Koha.Preference('ILLModuleCopyrightClearance') | $raw %]
82                                     </p>
83                                     [% USE link_url = url('/cgi-bin/koha/opac-illrequests.pl', whole.value.other) %]
84                                     <a href="[% link_url _ '&amp;stage=copyrightclearance' | $raw %]"
85                                     class="btn btn-sm btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Yes</a>
86                                     <a href="/cgi-bin/koha/opac-illrequests.pl"
87                                     class="btn btn-sm btn-danger"><i class="fa fa-times" aria-hidden="true"></i> No</a>
88                                 </div>
89                             [% ELSE %]
90                                 [% INCLUDE messages %]
91                                 [% IF backends %]
92                                     <form method="post" id="illrequestcreate-form" novalidate="novalidate">
93                                         <legend class="sr-only">Backends</legend>
94                                         <fieldset class="rows">
95                                             <label for="backend">Provider:</label>
96                                             <select name="backend">
97                                                 [% FOREACH backend IN backends %]
98                                                     <option value="[% backend | html %]">[% backend | html %]</option>
99                                                 [% END %]
100                                             </select>
101                                         </fieldset>
102                                         <fieldset class="action">
103                                             <input type="hidden" name="method" value="create" />
104                                             <input type="submit" name="create_select_backend" value="Next" />
105                                         </fieldset>
106                                     </form>
107                                 [% ELSE %]
108                                     [% PROCESS $whole.opac_template %]
109                                 [% END %]
110                             [% END # /IF stage == 'copyrightclearance' %]
111                         [% ELSIF method == 'list' %]
112                             <h1>Interlibrary loan requests</h1>
113                             [% INCLUDE messages %]
114
115                             <div id="illrequests-create-button" class="dropdown btn-group">
116                                 [% IF backends.size > 1 %]
117                                         <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
118                                             <i class="fa fa-plus" aria-hidden="true"></i> Create a new request <span class="caret"></span>
119                                         </button>
120                                         <div id="backend-dropdown-options" class="dropdown-menu nojs" aria-labelledby="ill-backend-dropdown">
121                                             [% FOREACH backend IN backends %]
122                                                 <a class="dropdown-item" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend | uri %]">[% backend | html %]</a>
123                                             [% END %]
124                                         </div>
125                                 [% ELSE %]
126                                     <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 | html %]">
127                                         <i class="fa fa-plus" aria-hidden="true"></i> Create a new request
128                                     </a>
129                                 [% END %]
130                             </div>
131
132                             <table id="illrequestlist" class="table table-bordered table-striped">
133                                 <caption class="sr-only">Requests</caption>
134                                 <thead>
135                                     <tr>
136                                         <th>Request ID</th>
137                                         <th>Author</th>
138                                         <th>Title</th>
139                                         <th>Requested from</th>
140                                         <th>Request type</th>
141                                         <th>Status</th>
142                                         <th>Request placed</th>
143                                         <th>Last updated</th>
144                                         <th></th>
145                                     </tr>
146                                 </thead>
147                                 <tbody>
148                                     [% FOREACH request IN requests %]
149                                         [% status = request.status | html %]
150                                         [% type = request.get_type %]
151                                         <tr>
152                                             <td>[% request.id | html %]</td>
153                                             <td>
154                                                 [% IF request.metadata.Author %][% request.metadata.Author | html %][% ELSE %]<span>N/A</span>[% END %]
155                                             </td>
156                                             <td>
157                                                 [% IF request.metadata.Title %][% request.metadata.Title | html %][% ELSE %]<span>N/A</span>[% END %]
158                                             </td>
159                                             <td>[% request.backend | html %]</td>
160                                             <td>
161                                                 [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
162                                             </td>
163                                             <td>[% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]</td>
164                                             <td data-order="[% request.placed | html %]">[% request.placed | $KohaDates %]</td>
165                                             <td data-order="[% request.updated | html %]">[% request.updated | $KohaDates %]</td>
166                                             <td>
167                                                 <a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id | uri %]" class="btn btn-primary btn-sm pull-right">View</a>
168                                             </td>
169                                         </tr>
170                                     [% END %]
171                                 </tbody>
172                             </table>
173                         [% ELSIF method == 'view' %]
174                             <h1>View interlibrary loan request</h1>
175                             [% INCLUDE messages %]
176                             [% status = request.status %]
177                             <form method="post" action="?method=update" id="illrequestupdate-form" novalidate="novalidate">
178                                 <fieldset class="rows">
179                                     <legend id="library_legend">Details from library</legend>
180                                     <ol>
181                                         [% type = request.get_type %]
182                                         <li>
183                                             <label for="request_id">Request ID:</label>
184                                             [% request.id | html %]
185                                         </li>
186                                         <li>
187                                             <label for="backend">Requested from:</label>
188                                             [% request.backend | html %]
189                                         </li>
190                                         [% IF request.biblio_id %]
191                                             <li>
192                                                 <label for="biblio">Requested item:</label>
193                                                 <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% request.biblio_id | uri %]">View the requested item</a>
194                                             </li>
195                                         [% END %]
196                                         <li>
197                                             <label for="branchcode">Collection library:</label>
198                                             [% Branches.GetName(request.branchcode) | html %]
199                                         </li>
200                                         <li>
201                                             <label for="status">Status:</label>
202                                             [% request.status_alias ? request.statusalias.lib_opac : request.capabilities.$status.name | html %]
203                                         </li>
204                                         <li>
205                                             <label for="medium">Request type:</label>
206                                             [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
207                                         </li>
208                                         <li>
209                                             <label for="placed">Request placed:</label>
210                                             [% request.placed | $KohaDates %]
211                                         </li>
212                                         <li>
213                                             <label for="updated">Last updated:</label>
214                                             [% request.updated | $KohaDates %]
215                                         </li>
216                                         <li>
217                                             <label for="notesopac">Notes:</label>
218                                             [% IF !request.completed %]
219                                                 <textarea name="notesopac" rows="5" cols="50">[% request.notesopac | html %]</textarea>
220                                             [% ELSE %]
221                                                 [% request.notesopac | html %]
222                                             [% END %]
223                                         </li>
224                                     </ol>
225                                 </fieldset>
226                                 <div id="ill-supplier-metadata" class="rows">
227                                     <legend id="backend_legend">Details from [% request.backend | html %]</legend>
228                                     [% FOREACH meta IN request.metadata %]
229                                         <div class="requestattr-[% meta.key | replace(' ', '_') | html %]">
230                                             <span class="label">[% meta.key | html %]:</span>
231                                             <span class="value">[% IF meta.value %][% meta.value | html %][% ELSE %]N/A[% END %]</span>
232                                         </div>
233                                     [% END %]
234                                 </div>
235                                 <fieldset class="action illrequest-actions">
236                                     <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
237                                     <input type="hidden" name="method" value="update" />
238                                     [% IF !request.completed %]
239                                         [% IF request.status == "NEW" %]
240                                             <a class="cancel-illrequest btn btn-danger" href="/cgi-bin/koha/opac-illrequests.pl?method=cancreq&amp;illrequest_id=[% request.illrequest_id | html %]">Request cancellation</a>
241                                         [% END %]
242                                         <input type="submit" class="update-illrequest btn btn-primary" value="Submit modifications" />
243                                     [% END %]
244                                     <span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
245                                 </fieldset>
246                             </form>
247                         [% ELSIF method == 'availability' %]
248                             <h1>Interlibrary loan item availability</h1>
249                             <div id="results">
250                                 <form method="POST" action="/cgi-bin/koha/opac-illrequests.pl">
251                                     <legend><h2>Displaying availability results</h2></legend>
252                                     [% FOREACH key IN whole.keys %]
253                                         [% value = whole.$key %]
254                                         [% IF key != 'custom_key' && key != 'custom_value' %]
255                                         <input type="hidden" name="[% key | html %]" value="[% value | html %]">
256                                         [% END %]
257                                     [% END %]
258                                     [% custom_keys = whole.custom_key.split('\0') %]
259                                     [% custom_values = whole.custom_value.split('\0') %]
260                                     [% i = 0 %]
261                                     [% FOREACH custom_key IN custom_keys %]
262                                         <input type="hidden" name="custom_key" value="[% custom_key | html %]">
263                                         <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
264                                     [% i = i + 1 %]
265                                     [% END %]
266                                     <input type="hidden" name="checked_availability" value="1">
267                                     <div id="continue-request-row" class="alert">
268                                         If you can't find what you are looking for, you can
269                                         <button class="button" type="submit">continue creating your request</button> or
270                                         <a href="/cgi-bin/koha/opac-illrequests.pl">cancel your request</a>
271                                     </div>
272                                 </form>
273                                 [% FOR service IN services %]
274                                     <h3 class="ill_availability_sourcename">[% service.name | html %]</h3>
275                                     [% INCLUDE 'ill-availability-table.inc' service=service %]
276                                 [% END %]
277                             </div> <!-- /#illrequestupdate-form -->
278                         [% END # / IF method == 'create' %]
279                     </div> <!-- / #illrequests -->
280                 [% END # /IF !backends_available %]
281             </div> <!-- / .col-lg-10/12 -->
282         </div> <!-- / .row -->
283     </div> <!-- / .container-fluid -->
284 </div> <!-- / .main -->
285
286 [% INCLUDE 'opac-bottom.inc' %]
287
288 [% BLOCK jsinclude %]
289     [% INCLUDE 'datatables.inc' %]
290     <script>
291         $("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
292             "columnDefs": [
293                 { "targets": [ -1 ], "sortable": false, "searchable": false }
294             ],
295             "order": [[ 3, "desc" ]],
296             "deferRender": true
297         }));
298         $("#backend-dropdown-options").removeClass("nojs");
299         [% IF services_json.length > 0 %]
300             var services = [% services_json | $raw %];
301         [% ELSE %]
302             var services = [];
303         [% END %]
304         [% IF metadata.length > 0 %]
305             var metadata = "[% metadata | $raw %]";
306         [% END %]
307     </script>
308     [% IF method == 'availability' %]
309         [% Asset.js("js/ill-availability.js") | $raw %]
310         <script>
311             $(document).ready(function() {
312                 window.doSearch();
313             });
314         </script>
315     [% END %]
316     [% TRY %]
317         [% PROCESS backend_jsinclude %]
318     [% CATCH %]
319     [% END %]
320 [% END %]