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 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
18 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
21 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
27 <a href="#" aria-current="page">Late orders</a>
32 <div class="main container-fluid">
34 <div class="col-sm-10 col-sm-push-2">
37 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
38 <div id="acqui_lateorders">
41 [% IF ( error_claim == "no_email" ) %]
42 <div class="dialog alert">This vendor has no email</div>
43 [% ELSIF ( error_claim == "no_order_selected" ) %]
44 <div class="dialog alert">No order selected</div>
46 <div class="dialog alert">[% error_claim | html %]</div>
50 <div class="dialog message">Email has been sent.</div>
52 [% IF lateorders.size %]
53 <form action="lateorders.pl" name="claim" method="post">
54 <input type="hidden" name="op" value="send_alert" />
55 <input type="hidden" name="delay" value="[% delay | html %]" />
56 <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
58 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
59 [% FOREACH letter IN letters %]
60 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
66 [% SET total_quantity = 0 %]
67 [% IF bookseller_filter %]
68 <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>
70 <table id="late_orders">
73 <th class="NoSort"></th>
76 <th>Estimated delivery date</th>
78 <th class="anti-the">Information</th>
88 <th>Internal note</th>
94 [% FOREACH lateorder IN lateorders %]
97 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
100 [% lateorder.ordernumber | $raw %]
102 <td data-order="[% lateorder.basket.closedate | html %]">
103 [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
105 [% IF lateorder.get_column('estimated_delivery_date') %]
106 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
107 [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
108 [% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
110 <td data-order="[% estimated_delivery_date | html %]">
111 <p class="delivery_date">
112 <span id="delivery_date_[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
113 [% IF CAN_user_acquisition_order_manage %]
114 <a class="edit_delivery_date noExport" data-ordernumber="[% lateorder.ordernumber | html %]" href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% lateorder.ordernumber | html %]" title="Edit delivery date">
115 <i class="fa fa-pencil"></i> Edit
121 [% lateorder.basket.bookseller.name | html %]
122 ([% lateorder.basket.bookseller.id | html %])
125 <span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span>
126 [% IF ( lateorder.biblio.author ) %]<br/><em>Author:</em> [% lateorder.biblio.author | html %][% END %]
127 [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
128 <br/><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %]
129 [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
130 <em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %]
135 [% lateorder.quantity | html %]
136 [% SET total_quantity = total_quantity + lateorder.quantity %]
139 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
140 [% SET total = total + subtotal %]
141 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
144 [% IF ( CAN_user_acquisition_order_manage ) %]
145 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
147 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
151 [% IF ( lateorder.basket.basketgroupid ) %]
152 [% IF ( CAN_user_acquisition_group_manage ) %]
153 <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>
155 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
159 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
161 <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
162 <td>[% lateorder.fund.budget_name | html %]</td>
163 <td>[% lateorder.claims.count | html %]</td>
164 <td data-order="[% lateorder.claims.last.claimed_on | html %]">
165 [% FOR claim IN lateorder.claims %]
166 [% claim.claimed_on | $KohaDates %]
167 [% UNLESS loop.last %]<br/>[% END %]
171 [% IF lateorder.order_internalnote %]
172 <p class="ordernote">
173 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
174 <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">
175 <i class="fa fa-pencil"></i> Edit internal note
179 <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">
180 <i class="fa fa-plus"></i> Add internal note
185 [% IF lateorder.order_vendornote %]
186 <p class="ordernote">
187 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
188 <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">
189 <i class="fa fa-pencil"></i> Edit vendor note
193 <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">
194 <i class="fa fa-plus"></i> Add vendor note
198 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
204 <th colspan="6">Total</th>
205 <th>[% total_quantity | html %]</th>
206 <th>[% total | $Price %]</th>
207 <th colspan="10"> </th>
212 <fieldset class="action">
213 <div class="btn-group">
214 <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>
215 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
216 <ul class="dropdown-menu" id="export-csv-menu">
217 <li><a href="#">Default</a></li>
218 [% IF csv_profiles.count %]
219 [% FOR csv IN csv_profiles %]
220 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
226 <input type="submit" class="btn btn-default" value="Claim order" />
229 [% ELSE %]<p>There are no late orders.</p>
231 </div> <!-- /#acqui_lateorders -->
233 </div> <!-- /.col-sm-10.col-sm-push-2 -->
235 <div class="col-sm-2 col-sm-pull-10">
237 <form action="lateorders.pl" method="get">
238 <fieldset class="brief">
239 <h4>Filter results:</h4>
240 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
241 [% 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 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
245 <li><label for="from">Estimated delivery date from: </label>
246 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="flatpickr" data-date_to="to"/>
247 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
249 <li><label for="to">To: </label>
250 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="flatpickr" />
251 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
254 <li><label for="booksellerid">Vendor:</label>
255 <select id="booksellerid" tabindex="" name="booksellerid">
256 <option value=""></option>
257 [% FOREACH bookseller IN booksellers %]
258 [% IF bookseller.id == bookseller_filter.id %]
259 <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
261 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
266 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
269 [% INCLUDE 'acquisitions-menu.inc' %]
271 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
274 <!-- Modal for editing vendor and internal notes -->
275 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
276 <div class="modal-dialog" role="document">
277 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
278 <div class="modal-content">
279 <div class="modal-header">
280 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
281 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
283 <div class="modal-body">
284 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
285 <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
286 <input type="hidden" name="op" value="save" />
287 <input type="hidden" id="type" name="type" value="" />
289 <div class="modal-footer">
290 <button type="submit" class="btn btn-default">Save</button>
291 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
298 <!-- Modal for editing estimated delivery date -->
299 <div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
300 <div class="modal-dialog" role="document">
301 <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
302 <div class="modal-content">
303 <div class="modal-header">
304 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
305 <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
307 <div class="modal-body">
308 <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
309 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
310 <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
311 <input type="hidden" name="op" value="save" />
313 <div class="modal-footer">
314 <button type="submit" class="btn btn-default">Save</button>
315 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
322 [% MACRO jsinclude BLOCK %]
323 [% Asset.js("js/acquisitions-menu.js") | $raw %]
324 [% INCLUDE 'datatables.inc' %]
325 [% INCLUDE 'columns_settings.inc' %]
326 [% INCLUDE 'calendar.inc' %]
329 function check_uncheck() {
330 var all_nodes = $(late_orderst.fnGetNodes());
331 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
332 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
333 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
335 $("input:checkbox[name=ordernumber]").prop('disabled', false);
339 $(document).ready(function() {
341 var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
342 late_orderst = KohaTable("late_orders", {
343 "sorting": [[ 1, "asc" ]],
344 "sPaginationType": "full",
346 "fnDrawCallback": function() {
347 if ( typeof late_orderst != 'undefined' ) {
349 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
353 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
354 $('#CheckAll').click(function(e){
356 $("#late_orders input:checkbox").prop("checked", true);
358 $('#CheckNone').click(function(e){
360 $("#late_orders input:checkbox").prop("checked", false);
363 // Generates a dynamic link for exporting the selection's data as CSV
364 $("#exportbutton, #export-csv-menu a").click(function() {
365 var all_nodes = $(late_orderst.fnGetNodes());
366 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
368 if (selected.length == 0) {
369 alert(_("Please select at least one item to export."));
373 var url = $('#exportbutton').attr('href') + '?';
374 // Building the url from currently checked boxes
375 for (var i = 0; i < selected.length; i++) {
376 url += '&ordernumber=' + selected[i].value;
378 if($(this).attr("data-value")) {
379 url += '&csv_profile=' + $(this).attr("data-value");
381 // And redirecting to the CSV page
386 $(".edit_note").on("click", function(e) {
388 var ordernumber = $(this).data("ordernumber");
389 var note_type = $(this).data("note_type");
390 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
391 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
392 $("#noteEditor .modal-title").text(modalTitle);
393 $("#notes_ordernumber").val( ordernumber );
394 $("#ordernotes").html( note_text );
395 $("#type").val( note_type );
396 $("#noteEditor").modal("show");
397 $("#ordernotes").focus();
400 $("#noteEditor").on('hidden.bs.modal', function (e) {
401 $("#noteEditorLabel").html("");
402 $("#noteEditor .modal-title").text("");
403 $("#ordernotes").html( "" );
404 $("#notes_ordernumber").val("");
408 $("#estimated_delivery_date").datepicker();
410 $(".edit_delivery_date").on("click", function(e) {
412 var ordernumber = $(this).data("ordernumber");
413 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
414 var date_text = $( "#delivery_date_" + ordernumber ).html();
415 $("#dateEditor .modal-title").text(modalTitle);
416 $("#date_ordernumber").val(ordernumber);
417 $("#estimated_delivery_date").html( date_text );
418 $("#dateEditor").modal("show");
421 $("#dateEditor").on('hidden.bs.modal', function (e) {
422 $("#dateEditorLabel").html("");
423 $("#dateEditor .modal-title").text("");
424 $("#estimated_delivery_date").html( "" );
425 $("#date_ordernumber").val("");
431 [% INCLUDE 'intranet-bottom.inc' %]