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