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' %]
19 [% WRAPPER 'sub-header.inc' %]
20 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
23 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
26 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
29 <a href="#" aria-current="page">Late orders</a>
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
40 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
41 <div id="acqui_lateorders">
44 [% IF ( error_claim == "no_email" ) %]
45 <div class="dialog alert">This vendor has no email</div>
46 [% ELSIF ( error_claim == "no_order_selected" ) %]
47 <div class="dialog alert">No order selected</div>
49 <div class="dialog alert">[% error_claim | html %]</div>
53 <div class="dialog message">Email has been sent.</div>
55 [% IF lateorders.size %]
56 <form action="lateorders.pl" name="claim" method="post">
57 <input type="hidden" name="op" value="send_alert" />
58 <input type="hidden" name="delay" value="[% delay | html %]" />
59 <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
61 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
62 [% FOREACH letter IN letters %]
63 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
69 [% SET total_quantity = 0 %]
70 [% IF bookseller_filter %]
71 <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>
73 <table id="late_orders">
76 <th class="NoSort"></th>
79 <th>Estimated delivery date</th>
81 <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 | $KohaDates %]" 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 fa-pencil"></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 %])
154 [% IF ( lateorder.basket.basketgroupid ) %]
155 [% IF ( CAN_user_acquisition_group_manage ) %]
156 <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 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
162 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
164 <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
165 <td>[% lateorder.fund.budget_name | html %]</td>
166 <td>[% lateorder.claims.count | html %]</td>
167 <td data-order="[% lateorder.claims.last.claimed_on | html %]">
168 [% FOR claim IN lateorder.claims %]
169 [% claim.claimed_on | $KohaDates %]
170 [% UNLESS loop.last %]<br/>[% END %]
174 [% IF lateorder.order_internalnote %]
175 <p class="ordernote">
176 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
177 <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">
178 <i class="fa fa-pencil"></i> Edit internal note
182 <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">
183 <i class="fa fa-plus"></i> Add internal note
188 [% IF lateorder.order_vendornote %]
189 <p class="ordernote">
190 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
191 <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">
192 <i class="fa fa-pencil"></i> Edit vendor note
196 <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">
197 <i class="fa fa-plus"></i> Add vendor note
201 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
207 <th colspan="6">Total</th>
208 <th>[% total_quantity | html %]</th>
209 <th>[% total | $Price %]</th>
210 <th colspan="10"> </th>
215 <fieldset class="action">
216 <div class="btn-group">
217 <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>
218 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
219 <ul class="dropdown-menu" id="export-csv-menu">
220 <li><a href="#">Default</a></li>
221 [% IF csv_profiles.count %]
222 [% FOR csv IN csv_profiles %]
223 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
229 <input type="submit" class="btn btn-default" value="Claim order" />
232 [% ELSE %]<p>There are no late orders.</p>
234 </div> <!-- /#acqui_lateorders -->
236 </div> <!-- /.col-sm-10.col-sm-push-2 -->
238 <div class="col-sm-2 col-sm-pull-10">
240 <form action="lateorders.pl" method="get">
241 <fieldset class="brief">
242 <h4>Filter results:</h4>
243 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
244 [% 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 %]
247 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
248 <li><label for="from">Estimated delivery date from: </label>
249 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="flatpickr" data-date_to="to"/>
250 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
252 <li><label for="to">To: </label>
253 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="flatpickr" />
254 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
257 <li><label for="booksellerid">Vendor:</label>
258 <select id="booksellerid" tabindex="" name="booksellerid">
259 <option value=""></option>
260 [% FOREACH bookseller IN booksellers %]
261 [% IF bookseller.id == bookseller_filter.id %]
262 <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
264 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
269 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
272 [% INCLUDE 'acquisitions-menu.inc' %]
274 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
277 <!-- Modal for editing vendor and internal notes -->
278 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
279 <div class="modal-dialog" role="document">
280 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
281 <div class="modal-content">
282 <div class="modal-header">
283 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
284 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
286 <div class="modal-body">
287 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
288 <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
289 <input type="hidden" name="op" value="save" />
290 <input type="hidden" id="type" name="type" value="" />
292 <div class="modal-footer">
293 <button type="submit" class="btn btn-default">Save</button>
294 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
301 <!-- Modal for editing estimated delivery date -->
302 <div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
303 <div class="modal-dialog" role="document">
304 <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
305 <div class="modal-content">
306 <div class="modal-header">
307 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
308 <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
310 <div class="modal-body">
311 <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | $KohaDates %]"/>
312 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
313 <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
314 <input type="hidden" name="op" value="save" />
316 <div class="modal-footer">
317 <button type="submit" class="btn btn-default">Save</button>
318 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
325 [% MACRO jsinclude BLOCK %]
326 [% Asset.js("js/acquisitions-menu.js") | $raw %]
327 [% INCLUDE 'datatables.inc' %]
328 [% INCLUDE 'columns_settings.inc' %]
329 [% INCLUDE 'calendar.inc' %]
332 function check_uncheck() {
333 var all_nodes = $(late_orderst.fnGetNodes());
334 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
335 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
336 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
338 $("input:checkbox[name=ordernumber]").prop('disabled', false);
342 $(document).ready(function() {
344 var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
345 late_orderst = KohaTable("late_orders", {
346 "sorting": [[ 1, "asc" ]],
347 "sPaginationType": "full",
349 "fnDrawCallback": function() {
350 if ( typeof late_orderst != 'undefined' ) {
352 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
356 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
357 $('#CheckAll').click(function(e){
359 $("#late_orders input:checkbox").prop("checked", true);
361 $('#CheckNone').click(function(e){
363 $("#late_orders input:checkbox").prop("checked", false);
366 // Generates a dynamic link for exporting the selection's data as CSV
367 $("#exportbutton, #export-csv-menu a").click(function() {
368 var all_nodes = $(late_orderst.fnGetNodes());
369 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
371 if (selected.length == 0) {
372 alert(_("Please select at least one item to export."));
376 var url = $('#exportbutton').attr('href') + '?';
377 // Building the url from currently checked boxes
378 for (var i = 0; i < selected.length; i++) {
379 url += '&ordernumber=' + selected[i].value;
381 if($(this).attr("data-value")) {
382 url += '&csv_profile=' + $(this).attr("data-value");
384 // And redirecting to the CSV page
389 $(".edit_note").on("click", function(e) {
391 var ordernumber = $(this).data("ordernumber");
392 var note_type = $(this).data("note_type");
393 var modalTitle = _("%s (order number %s)").format($(this).attr("title"), ordernumber);
394 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
395 $("#noteEditor .modal-title").text(modalTitle);
396 $("#notes_ordernumber").val( ordernumber );
397 $("#ordernotes").html( note_text );
398 $("#type").val( note_type );
399 $("#noteEditor").modal("show");
400 $("#ordernotes").focus();
403 $("#noteEditor").on('hidden.bs.modal', function (e) {
404 $("#noteEditorLabel").html("");
405 $("#noteEditor .modal-title").text("");
406 $("#ordernotes").html( "" );
407 $("#notes_ordernumber").val("");
411 $(".edit_delivery_date").on("click", function(e) {
413 var ordernumber = $(this).data("ordernumber");
414 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
415 var date_text = $( "#delivery_date_" + ordernumber ).data("delivery_date");
416 $("#dateEditor .modal-title").text(modalTitle);
417 $("#date_ordernumber").val(ordernumber);
418 $("#estimated_delivery_date").val(date_text);
419 $("#dateEditor").modal("show");
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("");
432 [% INCLUDE 'intranet-bottom.inc' %]