Bug 33908: Improve translation of title tags: Acquisitions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / lateorders.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE TablesSettings %]
6 [% USE Price %]
7 [% SET footerjs = 1 %]
8 [% PROCESS 'i18n.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>[% FILTER collapse %]
11     [% t("Late orders") | html %] &rsaquo;
12     [% t("Acquisitions") | html %] &rsaquo;
13     [% t("Koha") | html %]
14 [% END %]</title>
15 [% INCLUDE 'doc-head-close.inc' %]
16 </head>
17
18 <body id="acq_lateorders" class="acq">
19 [% WRAPPER 'header.inc' %]
20     [% INCLUDE 'acquisitions-search.inc' %]
21 [% END %]
22
23 [% WRAPPER 'sub-header.inc' %]
24     [% WRAPPER breadcrumbs %]
25         [% WRAPPER breadcrumb_item %]
26             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
27         [% END %]
28         [% WRAPPER breadcrumb_item bc_active= 1 %]
29             <span>Late orders</span>
30         [% END %]
31     [% END #/ WRAPPER breadcrumbs %]
32 [% END #/ WRAPPER sub-header.inc %]
33
34 <div class="main container-fluid">
35     <div class="row">
36         <div class="col-sm-10 col-sm-push-2">
37             <main>
38
39 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
40 <div id="acqui_lateorders" class="page-section">
41
42 [% IF error_claim %]
43     [% IF ( error_claim == "no_email" ) %]
44         <div class="dialog alert">This vendor has no email</div>
45     [% ELSIF ( error_claim == "no_order_selected" ) %]
46         <div class="dialog alert">No order selected</div>
47     [% ELSE %]
48         <div class="dialog alert">[% error_claim | html %]</div>
49     [% END %]
50 [% END %]
51 [% IF info_claim %]
52     <div class="dialog message">Email has been sent.</div>
53 [% END %]
54 [% IF lateorders.size %]
55 <form action="lateorders.pl" name="claim" method="post">
56   <input type="hidden" name="op" value="send_alert" />
57   <input type="hidden" name="delay" value="[% delay | html %]" />
58   <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
59         [% IF ( letters ) %]
60         <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
61           [% FOREACH letter IN letters %]
62                 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
63           [% END %]
64           </select>
65         </p>
66         [% END %]
67     [% SET total = 0 %]
68     [% SET total_quantity = 0 %]
69     [% IF bookseller_filter %]
70         <p><a id="CheckAll" href="#"><i class="fa fa-check"></i> Check all</a> <a id="CheckNone" href="#"><i class="fa fa-times"></i> Uncheck all</a></p>
71     [% END %]
72     <table id="late_orders">
73       <thead>
74         <tr>
75             <th class="NoSort"></th>
76             <th>Order line</th>
77             <th>Order date</th>
78             <th>Estimated delivery date</th>
79             <th>Vendor</th>
80             <th class="anti-the">Information</th>
81             <th>Quantity</th>
82             <th>Total cost</th>
83             <th>Basket</th>
84             <th>Basket group</th>
85             <th>Library</th>
86             <th>Budget</th>
87             <th>Fund</th>
88             <th>Claims count</th>
89             <th>Claimed date</th>
90             <th>Internal note</th>
91             <th>Vendor note</th>
92             <th>ISBN</th>
93         </tr>
94       </thead>
95       <tbody>
96       [% FOREACH lateorder IN lateorders %]
97         <tr>
98             <td>
99                 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
100             </td>
101             <td>
102                 [% lateorder.ordernumber | $raw %]
103             </td>
104             <td data-order="[% lateorder.basket.closedate | html %]">
105                 [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
106             </td>
107             [% IF lateorder.get_column('estimated_delivery_date') %]
108                 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
109             [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
110                 [% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
111             [% END %]
112             <td data-order="[% estimated_delivery_date | html %]">
113                 <p class="delivery_date">
114                     <span>[% estimated_delivery_date | $KohaDates %]</span>
115                     [% IF CAN_user_acquisition_order_manage %]
116                         <a class="edit_delivery_date noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-delivery_date="[% estimated_delivery_date | html %]" id="delivery_date_[% lateorder.ordernumber | html %]" href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% lateorder.ordernumber | html %]" title="Edit delivery date">
117                             <i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit
118                         </a>
119                     [% END %]
120                 </p>
121             </td>
122             <td>
123                 [% lateorder.basket.bookseller.name | html %]
124                 ([% lateorder.basket.bookseller.id | html %])
125             </td>
126             <td>
127                 <span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span>
128                    [% IF ( lateorder.biblio.author ) %]<br/><em>Author:</em> [% lateorder.biblio.author | html %][% END %]
129                    [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
130                         <br/><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %]
131                         [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
132                             <em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %]
133                         [% END %]
134                    [% END %]
135             </td>
136             <td>
137                 [% lateorder.quantity | html %]
138                 [% SET total_quantity = total_quantity + lateorder.quantity %]
139             </td>
140             <td>
141                 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
142                 [% SET total = total + subtotal %]
143                 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
144             </td>
145             <td>
146                 [% IF ( CAN_user_acquisition_order_manage ) %]
147                     <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
148                 [% ELSE %]
149                     [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
150                 [% END %]
151             </td>
152             <td>
153                 [% IF ( lateorder.basket.basketgroupid ) %]
154                     [% IF ( CAN_user_acquisition_group_manage ) %]
155                         <a href="basketgroup.pl?op=add&booksellerid=[% lateorder.basket.booksellerid | uri %]&basketgroupid=[% lateorder.basket.basketgroupid | uri %]" title="basketgroup">[% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
156                     [% ELSE %]
157                         [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
158                     [% END %]
159                 [% END %]
160             </td>
161             <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
162             </td>
163             <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
164             <td>[% lateorder.fund.budget_name | html %]</td>
165             <td>[% lateorder.claims.count | html %]</td>
166             <td data-order="[% lateorder.claims.last.claimed_on | html %]">
167                 [% FOR claim IN lateorder.claims %]
168                     [% claim.claimed_on | $KohaDates %]
169                     [% UNLESS loop.last %]<br/>[% END %]
170                 [% END %]
171             </td>
172             <td>
173                 [% IF lateorder.order_internalnote %]
174                     <p class="ordernote">
175                         <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
176                         <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" title="Edit internal note">
177                             <i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit internal note
178                         </a>
179                     </p>
180                 [% ELSE %]
181                     <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" title="Add internal note">
182                         <i class="fa fa-plus"></i> Add internal note
183                     </a>
184                 [% END %]
185             </td>
186             <td>
187                 [% IF lateorder.order_vendornote %]
188                     <p class="ordernote">
189                         <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
190                         <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" title="Edit vendor note">
191                             <i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit vendor note
192                         </a>
193                     </p>
194                 [% ELSE %]
195                     <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" title="Add vendor note">
196                         <i class="fa fa-plus"></i> Add vendor note
197                     </a>
198                 [% END %]
199             </td>
200             <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
201         </tr>
202       [% END %]
203       </tbody>
204       <tfoot>
205         <tr>
206             <th colspan="6">Total</th>
207             <th>[% total_quantity | html %]</th>
208             <th>[% total | $Price %]</th>
209             <th colspan="10">&nbsp;</th>
210         </tr>
211       </tfoot>
212     </table>
213
214     <fieldset class="action">
215         <div class="btn-group">
216           <a id="exportbutton" class="btn btn-default" href="/cgi-bin/koha/acqui/lateorders-export.pl"><i class="fa fa-download"></i> Export as CSV</a>
217           <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
218           <ul class="dropdown-menu" id="export-csv-menu">
219               <li><a href="#">Default</a></li>
220               [% IF csv_profiles.count %]
221                   [% FOR csv IN csv_profiles %]
222                     <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
223                   [% END %]
224               [% END %]
225            </ul>
226         </div>
227
228         <input type="submit"  class="btn btn-default" value="Claim order" />
229     </fieldset>
230 </form>
231 [% ELSE %]<p>There are no late orders.</p>
232 [% END %]
233 </div> <!-- /#acqui_lateorders -->
234 </main>
235 </div> <!-- /.col-sm-10.col-sm-push-2 -->
236
237 <div class="col-sm-2 col-sm-pull-10">
238     <aside>
239 <form action="lateorders.pl" method="get">
240 <fieldset class="brief">
241 <h4>Filter results:</h4>
242 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
243 [% IF ( ERROR_LOO.delay_digits ) %]<p class="error">The number of days ([% ERROR_LOO.bad_delay | html %]) must be a number between 0 and 999.</p>[% END %]
244 [% END %]
245 <ol>
246     <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
247     <li><label for="from">Estimated delivery date from: </label>
248         <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="flatpickr" data-date_to="to"/>
249         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
250     </li>
251     <li><label for="to">To: </label>
252         <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="flatpickr" />
253         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
254     </li>
255
256     <li><label for="booksellerid">Vendor:</label>
257         <select id="booksellerid" tabindex="" name="booksellerid">
258             <option value=""></option>
259             [% FOREACH bookseller IN booksellers %]
260                 [% IF bookseller.id == bookseller_filter.id %]
261                     <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
262                 [% ELSE %]
263                     <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
264                 [% END %]
265             [% END %]
266         </select>
267 </ol>
268 </fieldset>
269     <fieldset class="action"><input type="submit" class="btn btn-primary" value="Filter" /></fieldset>
270     </form>
271 [% INCLUDE 'acquisitions-menu.inc' %]
272 </aside>
273 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
274 </div>
275
276 <!-- Modal for editing vendor and internal notes -->
277 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
278     <div class="modal-dialog" role="document">
279         <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
280             <div class="modal-content">
281                 <div class="modal-header">
282                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
283                     <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
284                 </div>
285                 <div class="modal-body">
286                 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
287                 <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
288                 <input type="hidden" name="op" value="save" />
289                 <input type="hidden" id="type" name="type" value="" />
290             </div>
291             <div class="modal-footer">
292                 <button type="submit" class="btn btn-default">Save</button>
293                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
294             </div>
295             </div>
296         </form>
297     </div>
298 </div>
299
300 <!-- Modal for editing estimated delivery date -->
301 <div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
302     <div class="modal-dialog" role="document">
303         <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
304             <div class="modal-content">
305                 <div class="modal-header">
306                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
307                     <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
308                 </div>
309                 <div class="modal-body">
310                 <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | html %]"/>
311                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
312                 <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
313                 <input type="hidden" name="op" value="save" />
314             </div>
315             <div class="modal-footer">
316                 <button type="submit" class="btn btn-default">Save</button>
317                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
318             </div>
319             </div>
320         </form>
321     </div>
322 </div>
323
324 [% MACRO jsinclude BLOCK %]
325     [% Asset.js("js/acquisitions-menu.js") | $raw %]
326     [% INCLUDE 'datatables.inc' %]
327     [% INCLUDE 'columns_settings.inc' %]
328     [% INCLUDE 'calendar.inc' %]
329     <script>
330         var late_orderst;
331         function check_uncheck() {
332             var all_nodes = $(late_orderst.fnGetNodes());
333             if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
334                 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
335                 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
336             } else {
337                 $("input:checkbox[name=ordernumber]").prop('disabled', false);
338             }
339         }
340
341         $(document).ready(function() {
342
343             var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
344             late_orderst = KohaTable("late_orders", {
345                 "sorting": [[ 1, "asc" ]],
346                 "sPaginationType": "full",
347                 "bAutoWidth": false,
348                 "fnDrawCallback": function() {
349                     if ( typeof late_orderst != 'undefined' ) {
350                         check_uncheck();
351                         $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
352                     };
353                 }
354             }, table_settings );
355             $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
356             $('#CheckAll').click(function(e){
357                 e.preventDefault();
358                 $("#late_orders input:checkbox").prop("checked", true);
359             });
360             $('#CheckNone').click(function(e){
361                 e.preventDefault();
362                 $("#late_orders input:checkbox").prop("checked", false);
363             });
364
365             // Generates a dynamic link for exporting the selection's data as CSV
366             $("#exportbutton, #export-csv-menu a").click(function() {
367                 var all_nodes = $(late_orderst.fnGetNodes());
368                 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
369
370                 if (selected.length == 0) {
371                     alert(_("Please select at least one item to export."));
372                     return false;
373                 }
374
375                 var url = $('#exportbutton').attr('href') + '?';
376                 // Building the url from currently checked boxes
377                 for (var i = 0; i < selected.length; i++) {
378                     url += '&amp;ordernumber=' + selected[i].value;
379                 }
380                 if($(this).attr("data-value")) {
381                     url += '&amp;csv_profile=' + $(this).attr("data-value");
382                 }
383                 // And redirecting to the CSV page
384                 location.href = url;
385                 return false;
386             });
387
388             $(".edit_note").on("click", function(e) {
389                 e.preventDefault();
390                 var ordernumber = $(this).data("ordernumber");
391                 var note_type = $(this).data("note_type");
392                 var modalTitle = _("%s (order number %s)").format($(this).attr("title"), ordernumber);
393                 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
394                 $("#noteEditor .modal-title").text(modalTitle);
395                 $("#notes_ordernumber").val( ordernumber );
396                 $("#ordernotes").html( note_text );
397                 $("#type").val( note_type );
398                 $("#noteEditor").modal("show");
399                 $("#ordernotes").focus();
400             });
401
402              $("#noteEditor").on('hidden.bs.modal', function (e) {
403                 $("#noteEditorLabel").html("");
404                 $("#noteEditor .modal-title").text("");
405                 $("#ordernotes").html( "" );
406                 $("#notes_ordernumber").val("");
407                 $("#type").val("");
408             });
409
410             $(".edit_delivery_date").on("click", function(e) {
411                 e.preventDefault();
412                 var ordernumber = $(this).data("ordernumber");
413                 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
414                 var delivery_date = $( "#delivery_date_" + ordernumber ).data("delivery_date");
415                 const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr;
416                 estimated_delivery_date.setDate( delivery_date );
417                 $("#dateEditor .modal-title").text(modalTitle);
418                 $("#date_ordernumber").val(ordernumber);
419                 $("#dateEditor").modal("show");
420             });
421
422              $("#dateEditor").on('hidden.bs.modal', function (e) {
423                 $("#dateEditorLabel").html("");
424                 $("#dateEditor .modal-title").text("");
425                 $("#estimated_delivery_date").html( "" );
426                 $("#date_ordernumber").val("");
427             });
428         });
429     </script>
430 [% END %]
431
432 [% INCLUDE 'intranet-bottom.inc' %]