Bug 7317: Handle backend absense more gracefuly
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-illrequests.tt
1 [% USE Koha %]
2 [% USE Branches %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;   Your Interlibrary loan requests</title>[% INCLUDE 'doc-head-close.inc' %]
5 [% BLOCK cssinclude %][% END %]
6 </head>
7 [% INCLUDE 'bodytag.inc' bodyid='opac-illrequests' bodyclass='scrollto' %]
8 [% BLOCK messages %]
9     [% IF message == "1" %]
10         <div class="alert alert-success" role="alert">Request updated</div>
11     [% ELSIF message == "2" %]
12         <div class="alert alert-success" role="alert">Request placed</div>
13     [% END %]
14 [% END %]
15 [% INCLUDE 'masthead.inc' %]
16 <div class="main">
17     <ul class="breadcrumb noprint">
18         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
19         [% IF ( loggedinusername ) %]
20             <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">&rsaquo;</span></li>
21         [% END %]
22
23         [% IF method != 'list' %]
24             <li><a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a> <span class="divider">&rsaquo;</span></li>
25             [% IF method == 'create' %]
26                 <li>New Interlibrary loan request</li>
27             [% ELSIF method == 'view' %]
28                 <li>View Interlibrary loan request</li>
29             [% END %]
30         [% ELSE %]
31             <li>Interlibrary loan requests</li>
32         [% END %]
33
34     </ul> <!-- / .breadcrumb -->
35
36 <div class="container-fluid">
37     <div class="row-fluid">
38         [% IF ( OpacNav||loggedinusername ) && !print %]
39             <div class="span2">
40                 <div id="navigation">
41                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
42                 </div>
43             </div>
44         [% END %]
45
46         [% IF ( OpacNav||loggedinusername ) %]
47             <div class="span10">
48         [% ELSE %]
49             <div class="span12">
50         [% END %]
51           [% IF !backends_available %]
52             <div class="alert">ILL module configuration problem. Contact your administrator.</div>
53           [% ELSE %]
54             <div id="illrequests" class="maincontent">
55                 [% IF method == 'create' %]
56                     <h2>New Interlibrary loan request</h2>
57                     [% INCLUDE messages %]
58                     [% IF backends %]
59                         <form method="post" id="illrequestcreate-form" novalidate="novalidate">
60                             <fieldset class="rows">
61                                 <label for="backend">Provider:</label>
62                                 <select name="backend">
63                                     [% FOREACH backend IN backends %]
64                                         <option value="[% backend %]">[% backend %]</option>
65                                     [% END %]
66                                 </select>
67                             </fieldset>
68                             <fieldset class="action">
69                                 <input type="hidden" name="method" value="create">
70                                 <input type="submit" name="create_select_backend" value="Next &raquo;">
71                             </fieldset>
72                         </form>
73                     [% ELSE %]
74                         [% PROCESS $whole.opac_template %]
75                     [% END %]
76                 [% ELSIF method == 'list' %]
77                     <h2>Interlibrary loan requests</h2>
78                     [% INCLUDE messages %]
79
80                     <div id="illrequests-create-button" class="dropdown btn-group">
81                         [% IF backends.size > 1 %]
82                                 <button class="btn btn-default dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
83                                     <i class="fa fa-plus"></i> Create a new request <span class="caret"></span>
84                                 </button>
85                                 <ul id="backend-dropdown-options" class="dropdown-menu nojs" aria-labelledby="ill-backend-dropdown">
86                                     [% FOREACH backend IN backends %]
87                                         <li><a href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend %]">[% backend %]</a></li>
88                                     [% END %]
89                                 </ul>
90                         [% ELSE %]
91                             <a id="ill-new" class="btn btn-default" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 %]">
92                                 <i class="fa fa-plus"></i> Create a new request
93                             </a>
94                         [% END %]
95                     </div>
96
97                     <table id="illrequestlist" class="table table-bordered table-striped">
98                         <thead>
99                             <tr>
100                                 <th>Author</th>
101                                 <th>Title</th>
102                                 <th>Requested from</th>
103                                 <th>Request type</th>
104                                 <th>Status</th>
105                                 <th>Request placed</th>
106                                 <th>Last updated</th>
107                                 <th></th>
108                             </tr>
109                         </thead>
110                         <tbody>
111                             [% FOREACH request IN requests %]
112                                 [% status = request.status %]
113                                 <tr>
114                                     <td>[% request.metadata.Author || 'N/A' %]</td>
115                                     <td>[% request.metadata.Title || 'N/A' %]</td>
116                                     <td>[% request.backend %]</td>
117                                     <td>[% request.medium %]</td>
118                                     <td>[% request.capabilities.$status.name %]</td>
119                                     <td>[% request.placed %]</td>
120                                     <td>[% request.updated %]</td>
121                                     <td>
122                                         <a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id %]" class="btn btn-default btn-small pull-right">View</a>
123                                     </td>
124                                 </tr>
125                             [% END %]
126                         </tbody>
127                     </table>
128                 [% ELSIF method == 'view' %]
129                     <h2>View Interlibrary loan request</h2>
130                     [% INCLUDE messages %]
131                     [% status = request.status %]
132                     <form method="post" action="?method=update" id="illrequestupdate-form" novalidate="novalidate">
133                             <fieldset class="rows">
134                                 <legend id="library_legend">Details from library</legend>
135                                 <ol>
136                                     <li>
137                                         <label for="backend">Requested from:</label>
138                                         [% request.backend %]
139                                     </li>
140                                     [% IF request.biblio_id %]
141                                         <li>
142                                             <label for="biblio">Requested item:</label>
143                                             <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% request.biblio_id %]">Click here to view</a>
144                                         </li>
145                                     [% END %]
146                                     <li>
147                                         <label for="branchcode">Collection library:</label>
148                                         [% Branches.GetName(request.branchcode) %]
149                                     </li>
150                                     <li>
151                                         <label for="status">Status:</label>
152                                         [% request.capabilities.$status.name %]
153                                     </li>
154                                     <li>
155                                         <label for="medium">Request type:</label>
156                                         [% request.medium %]
157                                     </li>
158                                     <li>
159                                         <label for="placed">Request placed:</label>
160                                         [% request.placed %]
161                                     </li>
162                                     <li>
163                                         <label for="updated">Last updated:</label>
164                                         [% request.updated %]
165                                     </li>
166                                     <li>
167                                         <label for="notesopac">Notes:</label>
168                                         [% IF !request.completed %]
169                                             <textarea name="notesopac" rows="5" cols="50">[% request.notesopac %]</textarea>
170                                         [% ELSE %]
171                                             [% request.notesopac %]
172                                         [% END %]
173                                     </li>
174                                 </ol>
175                             </fieldset>
176                             <div class="rows">
177                                 <legend id="backend_legend">Details from [% request.backend %]</legend>
178                                 [% FOREACH meta IN request.metadata %]
179                                     <div class="requestattr-[% meta.key %]">
180                                         <span class="label">[% meta.key %]:</span>
181                                         [% meta.value || 'N/A' %]
182                                     </div>
183                                 [% END %]
184                             </div>
185                             <fieldset class="action illrequest-actions">
186                                 <input type="hidden" name="illrequest_id" value="[% request.illrequest_id %]">
187                                 <input type="hidden" name="method" value="update">
188                                 [% IF !request.completed %]
189                                     [% IF request.status == "NEW" %]
190                                         <a class="cancel-illrequest btn btn-danger" href="/cgi-bin/koha/opac-illrequests.pl?method=cancreq&amp;illrequest_id=[% request.illrequest_id %]">Request cancellation</a>
191                                     [% END %]
192                                     <input type="submit" class="update-illrequest btn btn-default" value="Submit modifications">
193                                 [% END %]
194                                 <span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
195                             </fieldset>
196                         </form>
197                     [% END %]
198                 </div> <!-- / .maincontent -->
199           [% END %]
200             </div> <!-- / .span10/12 -->
201         </div> <!-- / .row-fluid -->
202     </div> <!-- / .container-fluid -->
203 </div> <!-- / .main -->
204
205 [% INCLUDE 'opac-bottom.inc' %]
206
207 [% BLOCK jsinclude %]
208 [% INCLUDE 'datatables.inc' %]
209 <script type="text/javascript">
210     //<![CDATA[
211         $("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
212             "aoColumnDefs": [
213                 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }
214             ],
215             "aaSorting": [[ 3, "desc" ]],
216             "deferRender": true
217         }));
218         $("#backend-dropdown-options").removeClass("nojs");
219     //]]>
220 </script>
221 [% TRY %]
222 [% PROCESS backend_jsinclude %]
223 [% CATCH %]
224 [% END %]
225 [% END %]