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