]> git.koha-community.org Git - koha.git/blob - koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt
Bug 30733: Simplify translatable strings
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / request-article.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Context %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% USE Categories %]
7 [% USE ItemTypes %]
8 [% USE AuthorisedValues %]
9 [% USE Price %]
10 [% SET footerjs = 1 %]
11 [% SET article_requests_view = 1 %]
12 [% SET biblionumber = biblio.biblionumber %]
13 [% INCLUDE 'doc-head-open.inc' %]
14 [% SET libraries = Branches.all %]
15 [% SET categories = Categories.all.unblessed %]
16 [% SET columns = ['name', 'address', 'cardnumber', 'dateofbirth', 'category', 'branch', 'phone'] %]
17 [% PROCESS "patron-search.inc" %]
18 <title>Request article &rsaquo; Circulation &rsaquo; Koha</title>
19 [% INCLUDE 'doc-head-close.inc' %]
20 </head>
21
22 [% BLOCK cancel_modal %]
23     <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
24         <div class="modal-dialog" role="document">
25             <div class="modal-content">
26                 <div class="modal-header">
27                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
28                     <h3>Confirm deletion</h3>
29                 </div>
30
31                 <div class="modal-body">
32                     <p>Are you sure you want to cancel this article request?</p>
33
34                     <fieldset class="action">
35                         [% SET ar_cancellation = AuthorisedValues.GetAuthValueDropbox('AR_CANCELLATION') %]
36                         [% IF ar_cancellation.count %]
37                             <label for="cancellation-reason" class="col-sm-4">Cancellation reason: </label>
38                             <select class="cancellation-reason col-sm-8" name="cancellation-reason" id="modal-cancellation-reason">
39                                 <option value="" selected>Other reasons</option>
40                                 [% FOREACH reason IN ar_cancellation %]
41                                     <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
42                                 [% END %]
43                             </select>
44                         [% END %]
45                     </fieldset>
46                     <fieldset class="action">
47                         <div class="hint col-sm-offset-4">Enter reason</div>
48                         <input type="text" class="notes col-sm-offset-4 col-sm-8" name="notes" id="modal-notes"/>
49                     </fieldset>
50                 </div>
51
52                 <div class="modal-footer">
53                     <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger" data-dismiss="modal">Confirm cancellation</button>
54                     <a href="#" data-dismiss="modal">Cancel</a>
55                 </div>
56             </div>
57         </div>
58     </div>
59 [% END %]
60
61 <body id="circ_request-article" class="circ">
62     [% INCLUDE 'header.inc' %]
63     [% INCLUDE 'circ-search.inc' %]
64
65     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
66         <ol>
67             <li>
68                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
69             </li>
70
71             [% IF blocking_error %]
72                 <li>
73                     <a href="#" aria-current="page">
74                         Catalog
75                     </a>
76                 </li>
77
78             [% ELSE %]
79                 [% INCLUDE 'biblio-title.inc' link = 1 %]
80                 <li>
81                     <a href="#" aria-current="page">
82                         Request article
83                     </a>
84                 </li>
85             [% END %]
86         </ol>
87     </nav>
88
89 [% INCLUDE 'blocking_errors.inc' %]
90 <div class="main container-fluid">
91     <div class="row">
92         <div class="col-sm-10 col-sm-push-2">
93             <main>
94
95                     <h1>Request article from [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
96                     [% IF error_message %]
97                         <div class="dialog alert">
98                         [% SWITCH error_message %]
99                             [% CASE 'article_request_limit_reached'       %]<p>Patron reached daily limit.</p>
100                             [% CASE 'article_request_unhandled_exception' %]<p>An error has occurred. Check the logs.</p>
101                         [% END %]
102                         </div>
103                     [% END %]
104                     [% UNLESS patron %]
105                         <fieldset class="brief">
106                             <label>Search patrons</label>
107                             [% PROCESS patron_search_filters_simple %]
108                             [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
109                         </fieldset>
110                     [% ELSE %]
111                         [% IF biblio.can_article_request( patron ) %]
112                             [% IF article_request_fee > 0 %]
113                                 <div class="dialog alert">
114                                     Patron will be charged with <strong>[% article_request_fee | $Price %]</strong> for every request
115                                 </div>
116                             [% END %]
117                             <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
118                                 <input type="hidden" name="action" value="create" />
119                                 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
120                                 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id | html %]" />
121
122                                 <fieldset class="rows">
123                                     <legend>Place article request from [% biblio.title | html %] for [% patron.firstname | html %] [% patron.surname | html %] ( [% patron.cardnumber | html %] )</legend>
124                                     <ul>
125                                         <li>
126                                             <label for="title">Title:</label>
127                                             <input type="text" name="title" id="title" size="50"/>
128                                         </li>
129
130                                         <li>
131                                             <label for="author">Author:</label>
132                                             <input type="text" name="author" id="author" size="50"/>
133                                         </li>
134
135                                         <li>
136                                             <label for="volume">Volume:</label>
137                                             <input type="text" name="volume" id="volume" size="50"/>
138                                         </li>
139
140                                         <li>
141                                             <label for="issue">Issue:</label>
142                                             <input type="text" name="issue" id="issue" size="50"/>
143                                         </li>
144
145                                         <li>
146                                             <label for="date">Date:</label>
147                                             <input type="text" name="date" id="date" size="50"/>
148                                         </li>
149
150                                         <li>
151                                             <label for="toc_request">Table of contents:</label>
152                                             <input type="checkbox" name="toc_request" value="1"/>
153                                         </li>
154
155                                         <li>
156                                             <label for="pages">Pages:</label>
157                                             <input type="text" name="pages" id="pages" size="50"/>
158                                         </li>
159
160                                         <li>
161                                             <label for="chapters">Chapters:</label>
162                                             <input type="text" name="chapters" id="chapters" size="50"/>
163                                         </li>
164
165                                         <li>
166                                             <label for="patron_notes">Patron notes:</label>
167                                             <input type="text" name="patron_notes" id="patron_notes" size="50"/>
168                                         </li>
169
170                                         <li>
171                                             <label for="format">Format:</label>
172                                             <select name="format" id="format">
173                                                 <option value="PHOTOCOPY">Photocopy</option>
174                                                 <option value="SCAN">Digital scan</option>
175                                             </select>
176                                         </li>
177
178                                         <li>
179                                             <label for="branchcode">Pickup library:</label>
180                                             <select name="branchcode" id="branchcode">
181                                                 [% FOREACH b IN Branches.all %]
182                                                     [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
183                                                         <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
184                                                     [% ELSE %]
185                                                         <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
186                                                     [% END %]
187                                                 [% END %]
188                                             </select>
189                                         </li>
190                                     </ul>
191                                 </fieldset>
192
193                                 [% SET article_request_type = biblio.article_request_type( patron ) %]
194                                 [% IF article_request_type != 'bib_only' %]
195                                     <table id="current-requests-table" class="ar-table table table-bordered table-striped">
196                                         <caption>Select item:</caption>
197                                         <thead>
198                                             <tr>
199                                                 <th>&nbsp;</th>
200                                                 <th>Item type</th>
201                                                 <th>Barcode</th>
202                                                 <th>Home library</th>
203                                                 <th>Call number</th>
204                                                 <th>Enumeration</th>
205                                             </tr>
206                                         </thead>
207
208                                         <tbody>
209                                             [% FOREACH item IN biblio.items %]
210                                                 [% IF item.can_article_request( patron ) %]
211                                                     <tr>
212                                                         <td>
213                                                             [% IF article_request_type == 'item_only' && !checked %]
214                                                                 [% SET checked = 1 %]
215                                                                 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
216                                                             [% ELSE %]
217                                                                 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
218                                                             [% END %]
219                                                         </td>
220                                                         <td>
221                                                             [% ItemTypes.GetDescription( item.itype ) | html %]
222                                                         </td>
223                                                         <td>
224                                                             [% item.barcode | html %]
225                                                         </td>
226                                                         <td>
227                                                             [% Branches.GetName( item.homebranch ) | html %]
228                                                         </td>
229                                                         <td>
230                                                             [% item.itemcallnumber | html %]
231                                                         </td>
232                                                         <td>
233                                                             [% item.enumchron | html %]
234                                                         </td>
235                                                     </tr>
236                                                 [% END %]
237                                             [% END %]
238
239                                             [% IF article_request_type != 'item_only' %]
240                                                 <tr>
241                                                     <td>
242                                                         <input type="radio" name="itemnumber" value="" checked="checked"/>
243                                                     </td>
244                                                     <td colspan="5">
245                                                         Any item
246                                                     </td>
247                                                 </tr>
248                                             [% END %]
249                                         </tbody>
250                                     </table>
251                                 [% END %]
252
253                                 <p>
254                                     <input type="submit" class="btn btn-default" value="Place request" />
255                                 </p>
256                             </form>
257                         [% ELSE %]
258                             No article requests can be made for this record.
259                         [% END %]
260
261                     [% END %]
262
263                     [% SET biblio_current_article_requests = Context.Scalar( Context.Scalar( biblio, 'article_requests' ), 'filter_by_current' ) %]
264                     [% IF biblio_current_article_requests.count > 0 && !patron %]
265                         <fieldset class="rows left" id="current-article-requests-fieldset">
266                             <legend>Current article requests</legend>
267
268                             <table id="current-article-requests-table">
269                                 <tr>
270                                     <th>Placed on</th>
271                                     <th>Patron</th>
272                                     <th>Title</th>
273                                     <th>Author</th>
274                                     <th>Volume</th>
275                                     <th>Issue</th>
276                                     <th>Date</th>
277                                     <th>TOC</th>
278                                     <th>Pages</th>
279                                     <th>Chapters</th>
280                                     <th>Patron notes</th>
281                                     <th>Format</th>
282                                     <th>Item</th>
283                                     <th>Status</th>
284                                     <th>Pickup library</th>
285                                     <th>&nbsp;</th>
286                                 </tr>
287
288                                 [% FOREACH ar IN biblio_current_article_requests %]
289                                     <tr>
290                                         <td>[% ar.created_on | $KohaDates %]</td>
291                                         <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber | uri %]">[% ar.borrower.firstname | html %] [% ar.borrower.surname | html %]</a></td>
292                                         <td>[% ar.title | html %]</td>
293                                         <td>[% ar.author | html %]</td>
294                                         <td>[% ar.volume | html %]</td>
295                                         <td>[% ar.issue | html %]</td>
296                                         <td>[% ar.date | html %]</td>
297                                         <td>[% IF ar.toc_request %]Yes[% END %]</td>
298                                         <td>[% ar.pages | html %]</td>
299                                         <td>[% ar.chapters | html %]</td>
300                                         <td>[% ar.patron_notes | html %]</td>
301                                         <td>[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
302                                         <td>
303                                             [% IF ar.item %]
304                                                 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber | uri %]&biblionumber=[% ar.biblionumber | uri %]">[% ar.item.barcode | html %]</a>
305                                             [% END %]
306                                         </td>
307                                         <td>
308                                             [% IF ar.status == 'PENDING' %]
309                                                 <span>Pending</span>
310                                             [% ELSIF ar.status == 'PROCESSING' %]
311                                                 <span>Processing</span>
312                                             [% ELSIF ar.status == 'REQUESTED' %]
313                                                 <span>New</span>
314                                             [% ELSIF ar.status == 'COMPLETED' %]
315                                                 <span>Completed</span>
316                                             [% ELSIF ar.status == 'CANCELED' %]
317                                                 <span>Canceled</span>
318                                             [% END %]
319                                         </td>
320                                         <td>
321                                             <i id="update-processing-[% ar.id | html %]" class="fa fa-cog fa-spin hidden"></i>
322                                             <select name="branchcode" id="branchcode-[% ar.id | html %]" class="ar-update-branchcode">
323                                                 [% FOREACH b IN Branches.all %]
324                                                     [% IF b.branchcode == ar.branchcode %]
325                                                         <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
326                                                     [% ELSE %]
327                                                         <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
328                                                     [% END %]
329                                                 [% END %]
330                                             </select>
331                                         </td>
332                                         <td>
333                                             <a title="Cancel article request" href="#" id="cancel-[% ar.id | html %]" class="ar-cancel-request">
334                                                 <i id="cancel-processing-spinner-[% ar.id | html %]" class="fa fa-cog fa-spin hide"></i>
335                                                 <i id="cancel-processing-[% ar.id | html %]" class="fa fa-times fa-lg" style="color:red"></i>
336                                             </a>
337                                         </td>
338                                     </tr>
339                                 [% END %]
340                             </table>
341                         </fieldset>
342                         [% PROCESS cancel_modal %]
343                     [% END %]
344
345             </main>
346         </div> <!-- /.col-sm-10.col-sm-push-2 -->
347
348         <div class="col-sm-2 col-sm-pull-10">
349             <aside>
350                 [% INCLUDE 'biblio-view-menu.inc' %]
351             </aside>
352         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
353      </div> <!-- /.row -->
354
355 [% MACRO jsinclude BLOCK %]
356     [% INCLUDE 'datatables.inc' %]
357
358     <script>
359         $('#current-article-requests').ready(function() {
360             $(".hide").hide();
361         });
362
363         $(document).ready(function() {
364
365             $( ".ar-update-branchcode" ).on('focus', function(){
366                 previous_branchcode = this.value;
367             }).on('change', function(){
368                 var branchcode = this.value;
369                 var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
370
371                 if ( c ) {
372                     var id = this.id.split("branchcode-")[1];
373                     $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
374
375                     $.ajax({
376                         type: "POST",
377                         url: '/cgi-bin/koha/svc/article_request',
378                         data: {
379                             action: 'update_branchcode',
380                             id: id,
381                             branchcode: branchcode,
382                         },
383                         success: function( data ) {
384                             $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
385                         },
386                         dataType: 'json'
387                     });
388
389                 } else {
390                     this.value = previous_branchcode;
391                 }
392             });
393
394             $('#modal-cancellation-reason').on('change', function(e) {
395                 let reason = $(this).val();
396                 $('#modal-notes').attr('disabled', !!reason);
397             })
398
399             let cancel_a;
400             $("#cancelModalConfirmBtn").on("click",function(e) {
401                 var id = cancel_a.attr('id').split("cancel-")[1];
402                 $("#cancel-processing-" + id ).hide('slow');
403                 $("#cancel-processing-spinner-" + id ).show('slow');
404
405                 let reason = $("#modal-cancellation-reason").val();
406                 let notes = $("#modal-notes").val();
407                 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
408
409                 $.ajax({
410                     type: "DELETE",
411                     url: '/api/v1/article_requests/'+id+query,
412                     success: function( data ) {
413                         cancel_a.parents('tr').hide('slow');
414                     }
415                 });
416             });
417
418
419             $(".ar-cancel-request").on("click", function(){
420                 cancel_a = $(this);
421                 $('#cancelModal').modal();
422             });
423
424             // Initialize format(s)
425             var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
426             if( !supported_formats.match(/PHOTOCOPY/) )
427                 $('#format option[value="PHOTOCOPY"]').remove();
428             if( !supported_formats.match(/SCAN/) )
429                 $('#format option[value="SCAN"]').remove();
430
431             if( $('#format option').length > 1 ) {
432             // Select first listed format
433                 var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
434                 $('#format option[value="'+first_format+'"]').attr('selected', true);
435             }
436         });
437     </script>
438
439     [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber %]
440
441 [% END %]
442
443 [% INCLUDE 'intranet-bottom.inc' %]