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