Bug 16239: Update templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / request-article.tt
1 [% USE KohaDates %]
2 [% USE Branches %]
3 [% USE ItemTypes %]
4 [% SET article_requests_view = 1 %]
5 [% SET biblionumber = biblio.biblionumber %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Circulation &rsaquo; Request article</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10 [% INCLUDE 'datatables.inc' %]
11
12 <script type="text/javascript">
13 // <![CDATA[
14 $('#current-article-requests').ready(function() {
15     $(".hide").hide();
16 });
17
18 $(document).ready(function() {
19     $( "#patron" ).autocomplete({
20         source: "/cgi-bin/koha/circ/ysearch.pl",
21         minLength: 3,
22         select: function( event, ui ) {
23             $( "#patron" ).val( ui.item.cardnumber );
24             $( "#holds_patronsearch" ).submit();
25             return false;
26         }
27     })
28     .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
29         return $( "<li></li>" )
30         .data( "ui-autocomplete-item", item )
31         .append( "<a>" + item.surname + ", " + item.firstname +
32                  " (" + item.cardnumber + ") <small>" + item.address +
33                  " " + item.city + " " + item.zipcode + " " +
34                  item.country + "</small></a>" )
35         .appendTo( ul );
36     };
37
38     $( ".ar-update-branchcode" ).on('focus', function(){
39         previous_branchcode = this.value;
40     }).on('change', function(){
41         var branchcode = this.value;
42         var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
43
44         if ( c ) {
45             var id = this.id.split("branchcode-")[1];
46             $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
47
48             $.ajax({
49                 type: "POST",
50                 url: '/cgi-bin/koha/svc/article_request',
51                 data: {
52                     action: 'update_branchcode',
53                     id: id,
54                     branchcode: branchcode,
55                 },
56                 success: function( data ) {
57                     $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
58                 },
59                 dataType: 'json'
60             });
61
62         } else {
63             this.value = previous_branchcode;
64         }
65     });
66
67     $(".ar-cancel-request").on("click", function(){
68         var a = $(this);
69         var notes = prompt(_("Reason for cancellation:"));
70
71         if ( notes != null ) {
72             var id = this.id.split("cancel-")[1];
73             $("#cancel-processing-" + id ).hide('slow');
74             $("#cancel-processing-spinner-" + id ).show('slow');
75
76             $.ajax({
77                 type: "POST",
78                 url: '/cgi-bin/koha/svc/article_request',
79                 data: {
80                     action: 'cancel',
81                     id: id,
82                     notes: notes
83                 },
84                 success: function( data ) {
85                     a.parents('tr').hide('slow');
86                 },
87                 dataType: 'json'
88             });
89         }
90     });
91 });
92 // ]]>
93 </script>
94 </head>
95
96 <body id="circ_request-article" class="circ">
97     [% INCLUDE 'header.inc' %]
98     [% INCLUDE 'circ-search.inc' %]
99
100     <div id="breadcrumbs">
101         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
102         &rsaquo;
103         <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
104         &rsaquo;
105         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">[% biblio.title | html %]</a>
106         &rsaquo;
107         Request article
108     </div>
109
110     <div id="doc3" class="yui-t2">
111         <div id="bd">
112             <div id="yui-main">
113                 <div class="yui-b">
114
115                     <h1>Request article from <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.id %]">[% biblio.title | html %]</a></h1>
116                     [% IF no_patrons_found %]
117                         <div class="dialog alert">
118                             <h3>Patron not found</h3>
119                             <p>No patron with this name, please, try another</p>
120                         </div>
121                     [% ELSIF patrons %]
122                         <form id="article_request_patron_results" method="post">
123                             <fieldset>
124                                 <table id="table_borrowers">
125                                     <thead>
126                                         <tr>
127                                             <th></th>
128                                             <th>Name</th>
129                                             <th>Cardnumber</th>
130                                             <th>Category</th>
131                                             <th>Library</th>
132                                             <th>Address</th>
133                                         </tr>
134                                     </thead>
135                                     <tbody>
136                                         [% FOREACH patron IN patrons %]
137                                             <tr>
138                                                 <td><input type="radio" name="patron_id" value="[% patron.borrowernumber %]"/></td>
139                                                 <td>[% patron.surname %], [% patron.firstname %]</td>
140                                                 <td>[% patron.cardnumber %]</td>
141                                                 <td>[% patron.categorycode %]</td>
142                                                 <td>[% patron.branchcode %]</td>
143                                                 <td>[% patron.address %]</td>
144                                             </tr>
145                                         [% END %]
146                                     </tbody>
147                                 </table>
148                                 <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
149                                 <fieldset class="action"><input type="submit" value="Select" /></fieldset>
150                             </fieldset>
151                         </form>
152                     [% ELSIF !patron %]
153                         <form id="article_requests_patronsearch" action="request-article.pl" method="post">
154                             <fieldset class="brief">
155                                 <label for="patron">Patron: </label>
156                                 <div class="hint">Enter patron card number or partial name:</div>
157                                 <input type="text" size="40" id="patron" class="focus" name="patron_cardnumber" />
158                                 <input type="submit" value="Search" />
159                                 <input type="hidden" name="biblionumber" value="[% biblio.id %]" />
160                             </fieldset>
161                         </form>
162                     [% ELSE %]
163                         [% IF biblio.can_article_request( patron ) %]
164
165                             <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
166                                 <input type="hidden" name="action" value="create" />
167                                 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
168                                 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id %]" />
169
170                                 <fieldset class="rows">
171                                     <legend>Place article request from [% biblio.title %] for [% patron.firstname %] [% patron.surname %] ( [% patron.cardnumber %] )</legend>
172                                     <p/>
173                                     <ul>
174                                         <li>
175                                             <label for="title">Title:</label>
176                                             <input type="text" name="title" id="title" size="50"/>
177                                         </li>
178
179                                         <li>
180                                             <label for="author">Author:</label>
181                                             <input type="text" name="author" id="author" size="50"/>
182                                         </li>
183
184                                         <li>
185                                             <label for="volume">Volume:</label>
186                                             <input type="text" name="volume" id="volume" size="50"/>
187                                         </li>
188
189                                         <li>
190                                             <label for="issue">Issue:</label>
191                                             <input type="text" name="issue" id="issue" size="50"/>
192                                         </li>
193
194                                         <li>
195                                             <label for="date">Date:</label>
196                                             <input type="text" name="date" id="date" size="50"/>
197                                         </li>
198
199                                         <li>
200                                             <label for="pages">Pages:</label>
201                                             <input type="text" name="pages" id="pages" size="50"/>
202                                         </li>
203
204                                         <li>
205                                             <label for="chapters">Chapters:</label>
206                                             <input type="text" name="chapters" id="chapters" size="50"/>
207                                         </li>
208
209                                         <li>
210                                             <label for="patron_notes">Patron notes:</label>
211                                             <input type="text" name="patron_notes" id="patron_notes" size="50"/>
212                                         </li>
213
214                                         <li>
215                                             <label for="branchcode">Pickup library:</label>
216                                             <select name="branchcode" id="branchcode">
217                                                 [% FOREACH b IN Branches.all %]
218                                                     [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
219                                                         <option value="[% b.branchcode %]" selected="selected">[% b.branchname %]</option>
220                                                     [% ELSE %]
221                                                         <option value="[% b.branchcode %]">[% b.branchname %]</option>
222                                                     [% END %]
223                                                 [% END %]
224                                             </select>
225                                         </li>
226                                     </ul>
227                                 </fieldset>
228
229                                 [% SET article_request_type = biblio.article_request_type( patron ) %]
230                                 [% IF article_request_type != 'bib_only' %]
231                                     <table id="current-requests-table" class="ar-table table table-bordered table-striped">
232                                         <caption>Select item:</caption>
233                                         <thead>
234                                             <tr>
235                                                 <th>&nbsp;</th>
236                                                 <th>Item type</th>
237                                                 <th>Barcode</th>
238                                                 <th>Home library</th>
239                                                 <th>Call number</th>
240                                                 <th>Enumeration</th>
241                                             </tr>
242                                         </thead>
243
244                                         <tbody>
245                                             [% FOREACH item IN biblio.items %]
246                                                 [% IF item.can_article_request( patron ) %]
247                                                     <tr>
248                                                         <td>
249                                                             [% IF article_request_type == 'item_only' && !checked %]
250                                                                 [% SET checked = 1 %]
251                                                                 <input type="radio" name="itemnumber" value="[% item.itemnumber %]" checked="checked" />
252                                                             [% ELSE %]
253                                                                 <input type="radio" name="itemnumber" value="[% item.itemnumber %]" />
254                                                             [% END %]
255                                                         </td>
256                                                         <td>
257                                                             [% ItemTypes.GetDescription( item.itype ) %]
258                                                         </td>
259                                                         <td>
260                                                             [% item.barcode %]
261                                                         </td>
262                                                         <td>
263                                                             [% Branches.GetName( item.homebranch ) %]
264                                                         </td>
265                                                         <td>
266                                                             [% item.itemcallnumber %]
267                                                         </td>
268                                                         <td>
269                                                             [% item.enumchron %]
270                                                         </td>
271                                                     </tr>
272                                                 [% END %]
273                                             [% END %]
274
275                                             [% IF article_request_type != 'item_only' %]
276                                                 <tr>
277                                                     <td>
278                                                         <input type="radio" name="itemnumber" value="" checked="checked"/>
279                                                     </td>
280                                                     <td colspan="5">
281                                                         Any item
282                                                     </td>
283                                                 </tr>
284                                             [% END %]
285                                         </tbody>
286                                     </table>
287                                 [% END %]
288
289                                 <p>
290                                     <input type="submit" class="btn btn-default" value="Place request" />
291                                 </p>
292                             </form>
293                         [% ELSE %]
294                             No article requests can be made for this record.
295                         [% END %]
296
297                     [% END %]
298
299                     [% IF biblio.article_requests_current && !patron %]
300                         <fieldset class="rows left" id="current-article-requests-fieldset">
301                             <legend>Current article requests</legend>
302
303                             <table id="current-article-requests-table">
304                                 <tr>
305                                     <th>Placed on</th>
306                                     <th>Patron</th>
307                                     <th>Title</th>
308                                     <th>Author</th>
309                                     <th>Volume</th>
310                                     <th>Issue</th>
311                                     <th>Date</th>
312                                     <th>Pages</th>
313                                     <th>Chapters</th>
314                                     <th>Patron notes</th>
315                                     <th>Item</th>
316                                     <th>Status</th>
317                                     <th>Pickup library</th>
318                                     <th>&nbsp;</th>
319                                 </tr>
320
321                                 [% FOREACH ar IN biblio.article_requests_current %]
322                                     <tr>
323                                         <td>[% ar.created_on | $KohaDates %]</td>
324                                         <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber %]">[% ar.borrower.firstname %] [% ar.borrower.surname %]</a></td>
325                                         <td>[% ar.title %]</td>
326                                         <td>[% ar.author %]</td>
327                                         <td>[% ar.volume %]</td>
328                                         <td>[% ar.issue %]</td>
329                                         <td>[% ar.date %]</td>
330                                         <td>[% ar.pages %]</td>
331                                         <td>[% ar.chapters %]</td>
332                                         <td>[% ar.patron_notes %]</td>
333                                         <td>
334                                             [% IF ar.item %]
335                                                 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber %]&biblionumber=[% ar.biblionumber %]">[% ar.item.barcode %]</a>
336                                             [% END %]
337                                         </td>
338                                         <td>
339                                             [% IF ar.status == 'PENDING' %]
340                                                 Pending
341                                             [% ELSIF ar.status == 'PROCESSING' %]
342                                                 Processing
343                                             [% ELSIF ar.status == 'COMPLETED' %]
344                                                 Completed
345                                             [% ELSIF ar.status == 'CANCELED' %]
346                                                 Canceled
347                                             [% END %]
348                                         </td>
349                                         <td>
350                                             <i id="update-processing-[% ar.id %]" class="fa fa-cog fa-spin hidden"></i>
351                                             <select name="branchcode" id="branchcode-[% ar.id %]" class="ar-update-branchcode">
352                                                 [% FOREACH b IN Branches.all %]
353                                                     [% IF b.branchcode == ar.branchcode %]
354                                                         <option value="[% b.branchcode %]" selected="selected">[% b.branchname %]</option>
355                                                     [% ELSE %]
356                                                         <option value="[% b.branchcode %]">[% b.branchname %]</option>
357                                                     [% END %]
358                                                 [% END %]
359                                             </select>
360                                         </td>
361                                         <td>
362                                             <a title="Cancel article request" href="#" id="cancel-[% ar.id %]" class="ar-cancel-request">
363                                                 <i id="cancel-processing-spinner-[% ar.id %]" class="fa fa-cog fa-spin hide"></i>
364                                                 <i id="cancel-processing-[% ar.id %]" class="fa fa-times fa-lg" style="color:red"></i>
365                                             </a>
366                                         </td>
367                                     </tr>
368                                 [% END %]
369                             </table>
370                         </fieldset>
371                     [% END %]
372                 </div>
373             </div>
374
375             <div class="yui-b">
376                 [% INCLUDE 'biblio-view-menu.inc' %]
377             </div>
378         </div>
379     </div>
380 [% INCLUDE 'intranet-bottom.inc' %]