5 [% USE TablesSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Late orders › Acquisitions › Koha</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="acq_lateorders" class="acq">
14 [% WRAPPER 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
18 [% WRAPPER 'sub-header.inc' %]
19 [% WRAPPER breadcrumbs %]
20 [% WRAPPER breadcrumb_item %]
21 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
23 [% WRAPPER breadcrumb_item bc_active= 1 %]
24 <span>Late orders</span>
26 [% END #/ WRAPPER breadcrumbs %]
27 [% END #/ WRAPPER sub-header.inc %]
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
34 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
35 <div id="acqui_lateorders" class="page-section">
38 [% IF ( error_claim == "no_email" ) %]
39 <div class="dialog alert">This vendor has no email</div>
40 [% ELSIF ( error_claim == "no_order_selected" ) %]
41 <div class="dialog alert">No order selected</div>
43 <div class="dialog alert">[% error_claim | html %]</div>
47 <div class="dialog message">Email has been sent.</div>
49 [% IF lateorders.size %]
50 <form action="lateorders.pl" name="claim" method="post">
51 <input type="hidden" name="op" value="send_alert" />
52 <input type="hidden" name="delay" value="[% delay | html %]" />
53 <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
55 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
56 [% FOREACH letter IN letters %]
57 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
63 [% SET total_quantity = 0 %]
64 [% IF bookseller_filter %]
65 <p><a id="CheckAll" href="#"><i class="fa fa-check"></i> Check all</a> <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Uncheck all</a></p>
67 <table id="late_orders">
70 <th class="NoSort"></th>
73 <th>Estimated delivery date</th>
75 <th class="anti-the">Information</th>
85 <th>Internal note</th>
91 [% FOREACH lateorder IN lateorders %]
94 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
97 [% lateorder.ordernumber | $raw %]
99 <td data-order="[% lateorder.basket.closedate | html %]">
100 [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
102 [% IF lateorder.get_column('estimated_delivery_date') %]
103 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
104 [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
105 [% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
107 <td data-order="[% estimated_delivery_date | html %]">
108 <p class="delivery_date">
109 <span>[% estimated_delivery_date | $KohaDates %]</span>
110 [% IF CAN_user_acquisition_order_manage %]
111 <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">
112 <i class="fa fa-pencil"></i> Edit
118 [% lateorder.basket.bookseller.name | html %]
119 ([% lateorder.basket.bookseller.id | html %])
122 <span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span>
123 [% IF ( lateorder.biblio.author ) %]<br/><em>Author:</em> [% lateorder.biblio.author | html %][% END %]
124 [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
125 <br/><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %]
126 [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
127 <em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %]
132 [% lateorder.quantity | html %]
133 [% SET total_quantity = total_quantity + lateorder.quantity %]
136 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
137 [% SET total = total + subtotal %]
138 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
141 [% IF ( CAN_user_acquisition_order_manage ) %]
142 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
144 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
148 [% IF ( lateorder.basket.basketgroupid ) %]
149 [% IF ( CAN_user_acquisition_group_manage ) %]
150 <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>
152 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
156 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
158 <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
159 <td>[% lateorder.fund.budget_name | html %]</td>
160 <td>[% lateorder.claims.count | html %]</td>
161 <td data-order="[% lateorder.claims.last.claimed_on | html %]">
162 [% FOR claim IN lateorder.claims %]
163 [% claim.claimed_on | $KohaDates %]
164 [% UNLESS loop.last %]<br/>[% END %]
168 [% IF lateorder.order_internalnote %]
169 <p class="ordernote">
170 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
171 <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">
172 <i class="fa fa-pencil"></i> Edit internal note
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="Add internal note">
177 <i class="fa fa-plus"></i> Add internal note
182 [% IF lateorder.order_vendornote %]
183 <p class="ordernote">
184 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
185 <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">
186 <i class="fa fa-pencil"></i> Edit vendor note
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="Add vendor note">
191 <i class="fa fa-plus"></i> Add vendor note
195 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
201 <th colspan="6">Total</th>
202 <th>[% total_quantity | html %]</th>
203 <th>[% total | $Price %]</th>
204 <th colspan="10"> </th>
209 <fieldset class="action">
210 <div class="btn-group">
211 <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>
212 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
213 <ul class="dropdown-menu" id="export-csv-menu">
214 <li><a href="#">Default</a></li>
215 [% IF csv_profiles.count %]
216 [% FOR csv IN csv_profiles %]
217 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
223 <input type="submit" class="btn btn-default" value="Claim order" />
226 [% ELSE %]<p>There are no late orders.</p>
228 </div> <!-- /#acqui_lateorders -->
230 </div> <!-- /.col-sm-10.col-sm-push-2 -->
232 <div class="col-sm-2 col-sm-pull-10">
234 <form action="lateorders.pl" method="get">
235 <fieldset class="brief">
236 <h4>Filter results:</h4>
237 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
238 [% 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 %]
241 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
242 <li><label for="from">Estimated delivery date from: </label>
243 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="flatpickr" data-date_to="to"/>
244 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
246 <li><label for="to">To: </label>
247 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="flatpickr" />
248 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
251 <li><label for="booksellerid">Vendor:</label>
252 <select id="booksellerid" tabindex="" name="booksellerid">
253 <option value=""></option>
254 [% FOREACH bookseller IN booksellers %]
255 [% IF bookseller.id == bookseller_filter.id %]
256 <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
258 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
264 <fieldset class="action"><input type="submit" class="btn btn-primary" value="Filter" /></fieldset>
266 [% INCLUDE 'acquisitions-menu.inc' %]
268 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
271 <!-- Modal for editing vendor and internal notes -->
272 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
273 <div class="modal-dialog" role="document">
274 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
275 <div class="modal-content">
276 <div class="modal-header">
277 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
278 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
280 <div class="modal-body">
281 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
282 <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
283 <input type="hidden" name="op" value="save" />
284 <input type="hidden" id="type" name="type" value="" />
286 <div class="modal-footer">
287 <button type="submit" class="btn btn-default">Save</button>
288 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
295 <!-- Modal for editing estimated delivery date -->
296 <div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
297 <div class="modal-dialog" role="document">
298 <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
299 <div class="modal-content">
300 <div class="modal-header">
301 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
302 <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
304 <div class="modal-body">
305 <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | html %]"/>
306 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
307 <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
308 <input type="hidden" name="op" value="save" />
310 <div class="modal-footer">
311 <button type="submit" class="btn btn-default">Save</button>
312 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
319 [% MACRO jsinclude BLOCK %]
320 [% Asset.js("js/acquisitions-menu.js") | $raw %]
321 [% INCLUDE 'datatables.inc' %]
322 [% INCLUDE 'columns_settings.inc' %]
323 [% INCLUDE 'calendar.inc' %]
326 function check_uncheck() {
327 var all_nodes = $(late_orderst.fnGetNodes());
328 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
329 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
330 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
332 $("input:checkbox[name=ordernumber]").prop('disabled', false);
336 $(document).ready(function() {
338 var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
339 late_orderst = KohaTable("late_orders", {
340 "sorting": [[ 1, "asc" ]],
341 "sPaginationType": "full",
343 "fnDrawCallback": function() {
344 if ( typeof late_orderst != 'undefined' ) {
346 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
350 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
351 $('#CheckAll').click(function(e){
353 $("#late_orders input:checkbox").prop("checked", true);
355 $('#CheckNone').click(function(e){
357 $("#late_orders input:checkbox").prop("checked", false);
360 // Generates a dynamic link for exporting the selection's data as CSV
361 $("#exportbutton, #export-csv-menu a").click(function() {
362 var all_nodes = $(late_orderst.fnGetNodes());
363 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
365 if (selected.length == 0) {
366 alert(_("Please select at least one item to export."));
370 var url = $('#exportbutton').attr('href') + '?';
371 // Building the url from currently checked boxes
372 for (var i = 0; i < selected.length; i++) {
373 url += '&ordernumber=' + selected[i].value;
375 if($(this).attr("data-value")) {
376 url += '&csv_profile=' + $(this).attr("data-value");
378 // And redirecting to the CSV page
383 $(".edit_note").on("click", function(e) {
385 var ordernumber = $(this).data("ordernumber");
386 var note_type = $(this).data("note_type");
387 var modalTitle = _("%s (order number %s)").format($(this).attr("title"), ordernumber);
388 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
389 $("#noteEditor .modal-title").text(modalTitle);
390 $("#notes_ordernumber").val( ordernumber );
391 $("#ordernotes").html( note_text );
392 $("#type").val( note_type );
393 $("#noteEditor").modal("show");
394 $("#ordernotes").focus();
397 $("#noteEditor").on('hidden.bs.modal', function (e) {
398 $("#noteEditorLabel").html("");
399 $("#noteEditor .modal-title").text("");
400 $("#ordernotes").html( "" );
401 $("#notes_ordernumber").val("");
405 $(".edit_delivery_date").on("click", function(e) {
407 var ordernumber = $(this).data("ordernumber");
408 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
409 var delivery_date = $( "#delivery_date_" + ordernumber ).data("delivery_date");
410 const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr;
411 estimated_delivery_date.setDate( delivery_date );
412 $("#dateEditor .modal-title").text(modalTitle);
413 $("#date_ordernumber").val(ordernumber);
414 $("#dateEditor").modal("show");
417 $("#dateEditor").on('hidden.bs.modal', function (e) {
418 $("#dateEditorLabel").html("");
419 $("#dateEditor .modal-title").text("");
420 $("#estimated_delivery_date").html( "" );
421 $("#date_ordernumber").val("");
427 [% INCLUDE 'intranet-bottom.inc' %]