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