5 [% USE TablesSettings %]
8 [% PROCESS 'i18n.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>[% FILTER collapse %]
11 [% t("Late orders") | html %] ›
12 [% t("Acquisitions") | html %] ›
13 [% t("Koha") | html %]
15 [% INCLUDE 'doc-head-close.inc' %]
18 <body id="acq_lateorders" class="acq">
19 [% WRAPPER 'header.inc' %]
20 [% INCLUDE 'acquisitions-search.inc' %]
23 [% WRAPPER 'sub-header.inc' %]
24 [% WRAPPER breadcrumbs %]
25 [% WRAPPER breadcrumb_item %]
26 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
28 [% WRAPPER breadcrumb_item bc_active= 1 %]
29 <span>Late orders</span>
31 [% END #/ WRAPPER breadcrumbs %]
32 [% END #/ WRAPPER sub-header.inc %]
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
39 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
40 <div id="acqui_lateorders" class="page-section">
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>
48 <div class="dialog alert">[% error_claim | html %]</div>
52 <div class="dialog message">Email has been sent.</div>
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 %]" />
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>
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>
72 <table id="late_orders">
75 <th class="NoSort"></th>
78 <th>Estimated delivery date</th>
80 <th class="anti-the">Information</th>
91 <th>Internal note</th>
97 [% FOREACH lateorder IN lateorders %]
100 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
103 [% lateorder.ordernumber | $raw %]
105 <td data-order="[% lateorder.basket.closedate | html %]">
106 [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
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') %]
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
124 [% lateorder.basket.bookseller.name | html %]
125 ([% lateorder.basket.bookseller.id | html %])
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 %]
138 [% lateorder.quantity | html %]
139 [% SET total_quantity = total_quantity + lateorder.quantity %]
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 %]
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>
150 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
153 <td data-order="[% lateorder.basket.creationdate | html %]">[% lateorder.basket.creationdate | $KohaDates %]</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>
159 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
163 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
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 %]
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
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
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
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
202 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
208 <th colspan="6">Total</th>
209 <th>[% total_quantity | html %]</th>
210 <th>[% total | $Price %]</th>
211 <th colspan="10"> </th>
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>
230 <input type="submit" class="btn btn-default" value="Claim order" />
233 [% ELSE %]<p>There are no late orders.</p>
235 </div> <!-- /#acqui_lateorders -->
237 </div> <!-- /.col-sm-10.col-sm-push-2 -->
239 <div class="col-sm-2 col-sm-pull-10">
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 %]
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>
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>
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>
265 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
271 <fieldset class="action"><input type="submit" class="btn btn-primary" value="Filter" /></fieldset>
273 [% INCLUDE 'acquisitions-menu.inc' %]
275 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
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">×</span></button>
285 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
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="" />
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>
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">×</span></button>
309 <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
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" />
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>
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' %]
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);
339 $("input:checkbox[name=ordernumber]").prop('disabled', false);
343 $(document).ready(function() {
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",
350 "fnDrawCallback": function() {
351 if ( typeof late_orderst != 'undefined' ) {
353 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
357 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
358 $('#CheckAll').click(function(e){
360 $("#late_orders input:checkbox").prop("checked", true);
362 $('#CheckNone').click(function(e){
364 $("#late_orders input:checkbox").prop("checked", false);
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");
372 if (selected.length == 0) {
373 alert(_("Please select at least one item to export."));
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 += '&ordernumber=' + selected[i].value;
382 if($(this).attr("data-value")) {
383 url += '&csv_profile=' + $(this).attr("data-value");
385 // And redirecting to the CSV page
390 $(".edit_note").on("click", function(e) {
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();
404 $("#noteEditor").on('hidden.bs.modal', function (e) {
405 $("#noteEditorLabel").html("");
406 $("#noteEditor .modal-title").text("");
407 $("#ordernotes").html( "" );
408 $("#notes_ordernumber").val("");
412 $(".edit_delivery_date").on("click", function(e) {
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");
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("");
435 [% INCLUDE 'intranet-bottom.inc' %]