5 [% USE TablesSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Acquisitions › Late orders</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 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
106 <td data-order="[% estimated_delivery_date | html %]">
107 [% estimated_delivery_date | $KohaDates %]
110 [% lateorder.basket.bookseller.name | html %]
111 ([% lateorder.basket.bookseller.id | html %])
114 <span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span>
115 [% IF ( lateorder.biblio.author ) %]<br/><em>Author:</em> [% lateorder.biblio.author | html %][% END %]
116 [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
117 <br/><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %]
118 [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
119 <em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %]
124 [% lateorder.quantity | html %]
125 [% SET total_quantity = total_quantity + lateorder.quantity %]
128 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
129 [% SET total = total + subtotal %]
130 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
133 [% IF ( CAN_user_acquisition_order_manage ) %]
134 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
136 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
140 [% IF ( lateorder.basket.basketgroupid ) %]
141 [% IF ( CAN_user_acquisition_group_manage ) %]
142 <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>
144 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
148 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
150 <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
151 <td>[% lateorder.fund.budget_name | html %]</td>
152 <td>[% lateorder.claims.count | html %]</td>
153 <td data-order="[% lateorder.claims.last.claimed_on | html %]">
154 [% FOR claim IN lateorder.claims %]
155 [% claim.claimed_on | $KohaDates %]
156 [% UNLESS loop.last %]<br/>[% END %]
160 [% IF lateorder.order_internalnote %]
161 <p class="ordernote">
162 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
163 <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">
164 <i class="fa fa-pencil"></i> Edit internal note
168 <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">
169 <i class="fa fa-plus"></i> Add internal note
174 [% IF lateorder.order_vendornote %]
175 <p class="ordernote">
176 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
177 <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">
178 <i class="fa fa-pencil"></i> Edit vendor note
182 <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">
183 <i class="fa fa-plus"></i> Add vendor note
187 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
193 <th colspan="6">Total</th>
194 <th>[% total_quantity | html %]</th>
195 <th>[% total | $Price %]</th>
196 <th colspan="10"> </th>
201 <fieldset class="action">
202 <div class="btn-group">
203 <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>
204 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
205 <ul class="dropdown-menu" id="export-csv-menu">
206 <li><a href="#">Default</a></li>
207 [% IF csv_profiles %]
208 [% FOR csv IN csv_profiles %]
209 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
215 <input type="submit" class="btn btn-default" value="Claim order" />
218 [% ELSE %]<p>There are no late orders.</p>
220 </div> <!-- /#acqui_lateorders -->
222 </div> <!-- /.col-sm-10.col-sm-push-2 -->
224 <div class="col-sm-2 col-sm-pull-10">
226 <form action="lateorders.pl" method="get">
227 <fieldset class="brief">
228 <h4>Filter results:</h4>
229 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
230 [% 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 %]
233 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
234 <li><label for="from">Estimated delivery date from: </label>
235 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
236 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
238 <li><label for="to">To: </label>
239 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
240 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
243 <li><label for="booksellerid">Vendor:</label>
244 <select id="booksellerid" tabindex="" name="booksellerid">
245 <option value=""></option>
246 [% FOREACH bookseller IN booksellers %]
247 [% IF bookseller.id == bookseller_filter.id %]
248 <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
250 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
255 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
258 [% INCLUDE 'acquisitions-menu.inc' %]
260 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
263 <!-- Modal for editing vendor and internal notes -->
264 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
265 <div class="modal-dialog" role="document">
266 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
267 <div class="modal-content">
268 <div class="modal-header">
269 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
270 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
272 <div class="modal-body">
273 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
274 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
275 <input type="hidden" name="op" value="save" />
276 <input type="hidden" id="type" name="type" value="" />
278 <div class="modal-footer">
279 <button type="submit" class="btn btn-default">Save</button>
280 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
287 [% MACRO jsinclude BLOCK %]
288 [% Asset.js("js/acquisitions-menu.js") | $raw %]
289 [% INCLUDE 'datatables.inc' %]
290 [% INCLUDE 'columns_settings.inc' %]
291 [% INCLUDE 'calendar.inc' %]
294 function check_uncheck() {
295 var all_nodes = $(late_orderst.fnGetNodes());
296 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
297 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
298 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
300 $("input:checkbox[name=ordernumber]").prop('disabled', false);
304 $(document).ready(function() {
306 var columns_settings = [% TablesSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
307 late_orderst = KohaTable("late_orders", {
308 "sorting": [[ 1, "asc" ]],
309 "sPaginationType": "full",
311 "fnDrawCallback": function() {
312 if ( typeof late_orderst != 'undefined' ) {
314 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
317 }, columns_settings );
318 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
319 $('#CheckAll').click(function(e){
321 $("#late_orders input:checkbox").prop("checked", true);
323 $('#CheckNone').click(function(e){
325 $("#late_orders input:checkbox").prop("checked", false);
328 // Generates a dynamic link for exporting the selection's data as CSV
329 $("#exportbutton, #export-csv-menu a").click(function() {
330 var all_nodes = $(late_orderst.fnGetNodes());
331 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
333 if (selected.length == 0) {
334 alert(_("Please select at least one item to export."));
338 var url = $('#exportbutton').attr('href') + '?';
339 // Building the url from currently checked boxes
340 for (var i = 0; i < selected.length; i++) {
341 url += '&ordernumber=' + selected[i].value;
343 if($(this).attr("data-value")) {
344 url += '&csv_profile=' + $(this).attr("data-value");
346 // And redirecting to the CSV page
351 $(".edit_note").on("click", function(e) {
353 var ordernumber = $(this).data("ordernumber");
354 var note_type = $(this).data("note_type");
355 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
356 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
357 $("#noteEditor .modal-title").text(modalTitle);
358 $("#ordernumber").val( ordernumber );
359 $("#ordernotes").html( note_text );
360 $("#type").val( note_type );
361 $("#noteEditor").modal("show");
362 $("#ordernotes").focus();
365 $("#noteEditor").on('hidden.bs.modal', function (e) {
366 $("#noteEditorLabel").html("");
367 $("#noteEditor .modal-title").text("");
368 $("#ordernotes").html( "" );
369 $("#ordernumber").val("");
376 [% INCLUDE 'intranet-bottom.inc' %]